From a5aab940e6c527b85da468846a8f875b8320bce0 Mon Sep 17 00:00:00 2001 From: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com> Date: Mon, 25 May 2020 12:46:40 +0800 Subject: [PATCH 1/5] Init for module: ImportExport and ImageBuilder (#11986) Co-authored-by: wyunchi-ms --- .../Az.ImageBuilder.format.ps1xml | 1283 +++++++++ src/ImageBuilder/Az.ImageBuilder.psd1 | 24 + src/ImageBuilder/Az.ImageBuilder.psm1 | 109 + src/ImageBuilder/MSSharedLibKey.snk | Bin 0 -> 160 bytes src/ImageBuilder/build-module.ps1 | 153 ++ src/ImageBuilder/check-dependencies.ps1 | 62 + .../custom/Az.ImageBuilder.custom.psm1 | 17 + .../New-AzImageBuilderCustomizerObject.ps1 | 166 ++ .../New-AzImageBuilderDistributorObject.ps1 | 109 + .../custom/New-AzImageBuilderSourceObject.ps1 | 117 + .../custom/New-AzImagerBuilderTemplate.ps1 | 319 +++ .../custom/Update-AzImageBuilderTemplate.ps1 | 331 +++ src/ImageBuilder/custom/readme.md | 41 + .../examples/Get-AzImageBuilderRunOutput.md | 32 + .../examples/Get-AzImageBuilderTemplate.md | 55 + .../New-AzImageBuilderCustomizerObject.md | 57 + .../New-AzImageBuilderDistributorObject.md | 35 + .../New-AzImageBuilderSourceObject.md | 34 + .../examples/New-AzImageBuilderTemplate.md | 19 + .../examples/Remove-AzImageBuilderTemplate.md | 17 + .../examples/Start-AzImageBuilderTemplate.md | 17 + .../examples/Stop-AzImageBuilderTemplate.md | 30 + src/ImageBuilder/export-surface.ps1 | 40 + .../exports/Get-AzImageBuilderRunOutput.ps1 | 186 ++ .../exports/Get-AzImageBuilderTemplate.ps1 | 198 ++ .../New-AzImageBuilderCustomizerObject.ps1 | 237 ++ .../New-AzImageBuilderDistributorObject.ps1 | 156 ++ .../New-AzImageBuilderSourceObject.ps1 | 165 ++ .../exports/New-AzImageBuilderTemplate.ps1 | 294 +++ .../exports/ProxyCmdletDefinitions.ps1 | 1797 +++++++++++++ .../exports/Remove-AzImageBuilderTemplate.ps1 | 183 ++ .../exports/Start-AzImageBuilderTemplate.ps1 | 183 ++ .../exports/Stop-AzImageBuilderTemplate.ps1 | 195 ++ src/ImageBuilder/exports/readme.md | 20 + src/ImageBuilder/generate-help.ps1 | 73 + src/ImageBuilder/generate-info.json | 8 + src/ImageBuilder/generated/Module.cs | 158 ++ .../generated/api/ImageBuilder.cs | 2329 +++++++++++++++++ .../Models/Api20200214/ApiError.PowerShell.cs | 143 + .../Api20200214/ApiError.TypeConverter.cs | 142 + .../api/Models/Api20200214/ApiError.cs | 137 + .../api/Models/Api20200214/ApiError.json.cs | 117 + .../Api20200214/ApiErrorBase.PowerShell.cs | 135 + .../Api20200214/ApiErrorBase.TypeConverter.cs | 142 + .../api/Models/Api20200214/ApiErrorBase.cs | 80 + .../Models/Api20200214/ApiErrorBase.json.cs | 105 + ...entitiesAdditionalproperties.PowerShell.cs | 134 + ...itiesAdditionalproperties.TypeConverter.cs | 147 ++ ...rassignedidentitiesAdditionalproperties.cs | 69 + ...gnedidentitiesAdditionalproperties.json.cs | 111 + .../Api20200214/ImageTemplate.PowerShell.cs | 189 ++ .../ImageTemplate.TypeConverter.cs | 142 + .../api/Models/Api20200214/ImageTemplate.cs | 414 +++ .../Models/Api20200214/ImageTemplate.json.cs | 107 + .../ImageTemplateCustomizer.PowerShell.cs | 135 + .../ImageTemplateCustomizer.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateCustomizer.cs | 69 + .../ImageTemplateCustomizer.json.cs | 134 + .../ImageTemplateDistributor.PowerShell.cs | 137 + .../ImageTemplateDistributor.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateDistributor.cs | 86 + .../ImageTemplateDistributor.json.cs | 128 + ...plateDistributorArtifactTags.PowerShell.cs | 137 + ...teDistributorArtifactTags.TypeConverter.cs | 144 + .../ImageTemplateDistributorArtifactTags.cs | 32 + ...plateDistributorArtifactTags.dictionary.cs | 70 + ...ageTemplateDistributorArtifactTags.json.cs | 105 + .../ImageTemplateFileCustomizer.PowerShell.cs | 141 + ...ageTemplateFileCustomizer.TypeConverter.cs | 142 + .../ImageTemplateFileCustomizer.cs | 124 + .../ImageTemplateFileCustomizer.json.cs | 107 + .../ImageTemplateIdentity.PowerShell.cs | 133 + .../ImageTemplateIdentity.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateIdentity.cs | 78 + .../Api20200214/ImageTemplateIdentity.json.cs | 103 + ...entityUserAssignedIdentities.PowerShell.cs | 140 + ...ityUserAssignedIdentities.TypeConverter.cs | 145 + ...eTemplateIdentityUserAssignedIdentities.cs | 37 + ...entityUserAssignedIdentities.dictionary.cs | 70 + ...lateIdentityUserAssignedIdentities.json.cs | 107 + .../ImageTemplateLastRunStatus.PowerShell.cs | 141 + ...mageTemplateLastRunStatus.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateLastRunStatus.cs | 114 + .../ImageTemplateLastRunStatus.json.cs | 109 + .../ImageTemplateListResult.PowerShell.cs | 135 + .../ImageTemplateListResult.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateListResult.cs | 63 + .../ImageTemplateListResult.json.cs | 111 + ...plateManagedImageDistributor.PowerShell.cs | 141 + ...teManagedImageDistributor.TypeConverter.cs | 144 + .../ImageTemplateManagedImageDistributor.cs | 96 + ...ageTemplateManagedImageDistributor.json.cs | 106 + ...geTemplateManagedImageSource.PowerShell.cs | 135 + ...emplateManagedImageSource.TypeConverter.cs | 142 + .../ImageTemplateManagedImageSource.cs | 69 + .../ImageTemplateManagedImageSource.json.cs | 103 + ...eTemplatePlatformImageSource.PowerShell.cs | 151 ++ ...mplatePlatformImageSource.TypeConverter.cs | 142 + .../ImageTemplatePlatformImageSource.cs | 200 ++ .../ImageTemplatePlatformImageSource.json.cs | 113 + ...TemplatePowerShellCustomizer.PowerShell.cs | 149 ++ ...platePowerShellCustomizer.TypeConverter.cs | 142 + .../ImageTemplatePowerShellCustomizer.cs | 154 ++ .../ImageTemplatePowerShellCustomizer.json.cs | 130 + .../ImageTemplateProperties.PowerShell.cs | 171 ++ .../ImageTemplateProperties.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateProperties.cs | 337 +++ .../ImageTemplateProperties.json.cs | 140 + ...ageTemplateRestartCustomizer.PowerShell.cs | 143 + ...TemplateRestartCustomizer.TypeConverter.cs | 142 + .../ImageTemplateRestartCustomizer.cs | 123 + .../ImageTemplateRestartCustomizer.json.cs | 109 + ...mplateSharedImageDistributor.PowerShell.cs | 145 + ...ateSharedImageDistributor.TypeConverter.cs | 143 + .../ImageTemplateSharedImageDistributor.cs | 142 + ...mageTemplateSharedImageDistributor.json.cs | 118 + ...lateSharedImageVersionSource.PowerShell.cs | 136 + ...eSharedImageVersionSource.TypeConverter.cs | 144 + .../ImageTemplateSharedImageVersionSource.cs | 69 + ...geTemplateSharedImageVersionSource.json.cs | 104 + ...ImageTemplateShellCustomizer.PowerShell.cs | 145 + ...geTemplateShellCustomizer.TypeConverter.cs | 142 + .../ImageTemplateShellCustomizer.cs | 120 + .../ImageTemplateShellCustomizer.json.cs | 118 + .../ImageTemplateSource.PowerShell.cs | 133 + .../ImageTemplateSource.TypeConverter.cs | 142 + .../Models/Api20200214/ImageTemplateSource.cs | 48 + .../Api20200214/ImageTemplateSource.json.cs | 126 + ...mageTemplateUpdateParameters.PowerShell.cs | 139 + ...eTemplateUpdateParameters.TypeConverter.cs | 142 + .../ImageTemplateUpdateParameters.cs | 101 + .../ImageTemplateUpdateParameters.json.cs | 103 + ...TemplateUpdateParametersTags.PowerShell.cs | 135 + ...plateUpdateParametersTags.TypeConverter.cs | 142 + .../ImageTemplateUpdateParametersTags.cs | 30 + ...TemplateUpdateParametersTags.dictionary.cs | 70 + .../ImageTemplateUpdateParametersTags.json.cs | 102 + .../ImageTemplateVMProfile.PowerShell.cs | 139 + .../ImageTemplateVMProfile.TypeConverter.cs | 142 + .../Api20200214/ImageTemplateVMProfile.cs | 110 + .../ImageTemplateVMProfile.json.cs | 105 + .../ImageTemplateVhdDistributor.PowerShell.cs | 137 + ...ageTemplateVhdDistributor.TypeConverter.cs | 142 + .../ImageTemplateVhdDistributor.cs | 62 + .../ImageTemplateVhdDistributor.json.cs | 101 + ...plateWindowsUpdateCustomizer.PowerShell.cs | 143 + ...teWindowsUpdateCustomizer.TypeConverter.cs | 144 + .../ImageTemplateWindowsUpdateCustomizer.cs | 135 + ...ageTemplateWindowsUpdateCustomizer.json.cs | 118 + .../Api20200214/InnerError.PowerShell.cs | 133 + .../Api20200214/InnerError.TypeConverter.cs | 142 + .../api/Models/Api20200214/InnerError.cs | 63 + .../api/Models/Api20200214/InnerError.json.cs | 103 + .../Api20200214/Operation.PowerShell.cs | 147 ++ .../Api20200214/Operation.TypeConverter.cs | 142 + .../api/Models/Api20200214/Operation.cs | 165 ++ .../api/Models/Api20200214/Operation.json.cs | 109 + .../OperationDisplay.PowerShell.cs | 137 + .../OperationDisplay.TypeConverter.cs | 142 + .../Models/Api20200214/OperationDisplay.cs | 97 + .../Api20200214/OperationDisplay.json.cs | 107 + .../OperationListResult.PowerShell.cs | 137 + .../OperationListResult.TypeConverter.cs | 142 + .../Models/Api20200214/OperationListResult.cs | 68 + .../Api20200214/OperationListResult.json.cs | 114 + .../OperationProperties.PowerShell.cs | 129 + .../OperationProperties.TypeConverter.cs | 142 + .../Models/Api20200214/OperationProperties.cs | 29 + .../Api20200214/OperationProperties.json.cs | 99 + .../PlatformImagePurchasePlan.PowerShell.cs | 137 + ...PlatformImagePurchasePlan.TypeConverter.cs | 142 + .../Api20200214/PlatformImagePurchasePlan.cs | 80 + .../PlatformImagePurchasePlan.json.cs | 105 + .../ProvisioningError.PowerShell.cs | 133 + .../ProvisioningError.TypeConverter.cs | 142 + .../Models/Api20200214/ProvisioningError.cs | 63 + .../Api20200214/ProvisioningError.json.cs | 103 + .../Models/Api20200214/Resource.PowerShell.cs | 139 + .../Api20200214/Resource.TypeConverter.cs | 142 + .../api/Models/Api20200214/Resource.cs | 123 + .../api/Models/Api20200214/Resource.json.cs | 118 + .../Api20200214/ResourceTags.PowerShell.cs | 133 + .../Api20200214/ResourceTags.TypeConverter.cs | 142 + .../api/Models/Api20200214/ResourceTags.cs | 30 + .../Api20200214/ResourceTags.dictionary.cs | 70 + .../Models/Api20200214/ResourceTags.json.cs | 102 + .../Api20200214/RunOutput.PowerShell.cs | 143 + .../Api20200214/RunOutput.TypeConverter.cs | 142 + .../api/Models/Api20200214/RunOutput.cs | 123 + .../api/Models/Api20200214/RunOutput.json.cs | 103 + .../RunOutputCollection.PowerShell.cs | 133 + .../RunOutputCollection.TypeConverter.cs | 142 + .../Models/Api20200214/RunOutputCollection.cs | 63 + .../Api20200214/RunOutputCollection.json.cs | 111 + .../RunOutputProperties.PowerShell.cs | 135 + .../RunOutputProperties.TypeConverter.cs | 142 + .../Models/Api20200214/RunOutputProperties.cs | 83 + .../Api20200214/RunOutputProperties.json.cs | 108 + .../Api20200214/SubResource.PowerShell.cs | 135 + .../Api20200214/SubResource.TypeConverter.cs | 142 + .../api/Models/Api20200214/SubResource.cs | 86 + .../Models/Api20200214/SubResource.json.cs | 111 + .../VirtualNetworkConfig.PowerShell.cs | 131 + .../VirtualNetworkConfig.TypeConverter.cs | 142 + .../Api20200214/VirtualNetworkConfig.cs | 46 + .../Api20200214/VirtualNetworkConfig.json.cs | 101 + .../Models/ImageBuilderIdentity.PowerShell.cs | 142 + .../ImageBuilderIdentity.TypeConverter.cs | 157 ++ .../api/Models/ImageBuilderIdentity.cs | 125 + .../api/Models/ImageBuilderIdentity.json.cs | 113 + .../ProvisioningErrorCode.Completer.cs | 75 + .../ProvisioningErrorCode.TypeConverter.cs | 59 + .../api/Support/ProvisioningErrorCode.cs | 115 + .../Support/ProvisioningState.Completer.cs | 51 + .../ProvisioningState.TypeConverter.cs | 59 + .../api/Support/ProvisioningState.cs | 103 + .../Support/ResourceIdentityType.Completer.cs | 39 + .../ResourceIdentityType.TypeConverter.cs | 59 + .../api/Support/ResourceIdentityType.cs | 97 + .../api/Support/RunState.Completer.cs | 55 + .../api/Support/RunState.TypeConverter.cs | 59 + .../generated/api/Support/RunState.cs | 105 + .../api/Support/RunSubState.Completer.cs | 47 + .../api/Support/RunSubState.TypeConverter.cs | 59 + .../generated/api/Support/RunSubState.cs | 101 + ...SharedImageStorageAccountType.Completer.cs | 39 + ...edImageStorageAccountType.TypeConverter.cs | 59 + .../Support/SharedImageStorageAccountType.cs | 103 + .../cmdlets/GetAzImageBuilderRunOutput_Get.cs | 415 +++ ...tAzImageBuilderRunOutput_GetViaIdentity.cs | 381 +++ .../GetAzImageBuilderRunOutput_List.cs | 412 +++ .../cmdlets/GetAzImageBuilderTemplate_Get.cs | 402 +++ ...etAzImageBuilderTemplate_GetViaIdentity.cs | 377 +++ .../cmdlets/GetAzImageBuilderTemplate_List.cs | 384 +++ .../GetAzImageBuilderTemplate_List1.cs | 400 +++ .../generated/cmdlets/GetAzOperation_List.cs | 361 +++ .../NewAzImageBuilderTemplate_Create.cs | 485 ++++ ...zImageBuilderTemplate_CreateViaIdentity.cs | 460 ++++ .../RemoveAzImageBuilderTemplate_Delete.cs | 507 ++++ ...zImageBuilderTemplate_DeleteViaIdentity.cs | 482 ++++ .../StartAzImageBuilderTemplate_Run.cs | 507 ++++ ...rtAzImageBuilderTemplate_RunViaIdentity.cs | 482 ++++ .../StopAzImageBuilderTemplate_Cancel.cs | 507 ++++ ...zImageBuilderTemplate_CancelViaIdentity.cs | 482 ++++ .../generated/runtime/AsyncCommandRuntime.cs | 828 ++++++ .../generated/runtime/AsyncJob.cs | 270 ++ .../runtime/AsyncOperationResponse.cs | 177 ++ .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 99 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 53 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 159 ++ .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 125 + .../BuildTime/Cmdlets/ExportTestStub.cs | 137 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 53 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 121 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 177 ++ .../runtime/BuildTime/Models/PsHelpTypes.cs | 199 ++ .../BuildTime/Models/PsMarkdownTypes.cs | 291 ++ .../BuildTime/Models/PsProxyOutputs.cs | 513 ++++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 499 ++++ .../runtime/BuildTime/PsAttributes.cs | 114 + .../runtime/BuildTime/PsExtensions.cs | 160 ++ .../generated/runtime/BuildTime/PsHelpers.cs | 104 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 249 ++ .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 ++ .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + .../generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 36 + .../generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../generated/runtime/EventListener.cs | 247 ++ src/ImageBuilder/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + .../generated/runtime/Extensions.cs | 111 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + .../generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 21 + .../generated/runtime/IHeaderSerializable.cs | 14 + .../generated/runtime/ISendAsync.cs | 289 ++ .../generated/runtime/InfoAttribute.cs | 34 + .../generated/runtime/Iso/IsoDate.cs | 214 ++ .../generated/runtime/JsonType.cs | 18 + src/ImageBuilder/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 68 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 ++ .../generated/runtime/Nodes/JsonNode.cs | 250 ++ .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 ++ .../generated/runtime/Nodes/JsonString.cs | 42 + .../generated/runtime/Nodes/XBinary.cs | 40 + .../generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 ++ .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 ++ .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 254 ++ .../generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 +++ .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 16 + .../runtime/TypeConverterExtensions.cs | 190 ++ .../runtime/UndeclaredResponseException.cs | 104 + .../generated/runtime/Writers/JsonWriter.cs | 223 ++ .../generated/runtime/delegates.cs | 23 + src/ImageBuilder/help/Az.ImageBuilder.md | 40 + .../help/Get-AzImageBuilderRunOutput.md | 194 ++ .../help/Get-AzImageBuilderTemplate.md | 205 ++ .../New-AzImageBuilderCustomizerObject.md | 425 +++ .../New-AzImageBuilderDistributorObject.md | 256 ++ .../help/New-AzImageBuilderSourceObject.md | 273 ++ .../help/New-AzImageBuilderTemplate.md | 467 ++++ .../help/Remove-AzImageBuilderTemplate.md | 233 ++ .../help/Start-AzImageBuilderTemplate.md | 233 ++ .../help/Stop-AzImageBuilderTemplate.md | 244 ++ src/ImageBuilder/how-to.md | 58 + .../internal/Az.ImageBuilder.internal.psm1 | 38 + src/ImageBuilder/internal/Get-AzOperation.ps1 | 121 + .../internal/New-AzImageBuilderTemplate.ps1 | 244 ++ .../internal/ProxyCmdletDefinitions.ps1 | 365 +++ src/ImageBuilder/internal/readme.md | 14 + src/ImageBuilder/pack-module.ps1 | 16 + src/ImageBuilder/readme.md | 118 + src/ImageBuilder/run-module.ps1 | 59 + src/ImageBuilder/test-module.ps1 | 68 + .../test/Az.ImageBuilder-TestResults.xml | 128 + ...Get-AzImageBuilderRunOutput.Recording.json | 158 ++ .../Get-AzImageBuilderRunOutput.Tests.ps1 | 30 + .../Get-AzImageBuilderTemplate.Recording.json | 275 ++ .../test/Get-AzImageBuilderTemplate.Tests.ps1 | 34 + ...w-AzImageBuilderCustomizerObject.Tests.ps1 | 57 + ...-AzImageBuilderDistributorObject.Tests.ps1 | 32 + .../New-AzImageBuilderSourceObject.Tests.ps1 | 34 + .../New-AzImageBuilderTemplate.Recording.json | 1674 ++++++++++++ .../test/New-AzImageBuilderTemplate.Tests.ps1 | 196 ++ ...move-AzImageBuilderTemplate.Recording.json | 667 +++++ .../Remove-AzImageBuilderTemplate.Tests.ps1 | 27 + ...tart-AzImageBuilderTemplate.Recording.json | 1135 ++++++++ .../Start-AzImageBuilderTemplate.Tests.ps1 | 27 + ...Stop-AzImageBuilderTemplate.Recording.json | 312 +++ .../Stop-AzImageBuilderTemplate.Tests.ps1 | 30 + .../Update-AzImageBuilderTemplate.Tests.ps1 | 38 + .../Update-AzImageBuilderTemplate.skip.ps1 | 42 + .../managed-image/parameters.json | 9 + .../managed-image/template.json | 37 + .../shared-image/parameters.json | 12 + .../shared-image/template.json | 88 + src/ImageBuilder/test/env.json | 87 + src/ImageBuilder/test/loadEnv.ps1 | 28 + src/ImageBuilder/test/readme.md | 17 + src/ImageBuilder/test/utils.ps1 | 161 ++ .../Az.ImportExport.format.ps1xml | 841 ++++++ src/ImportExport/Az.ImportExport.psd1 | 24 + src/ImportExport/Az.ImportExport.psm1 | 109 + src/ImportExport/MSSharedLibKey.snk | Bin 0 -> 160 bytes src/ImportExport/build-module.ps1 | 153 ++ src/ImportExport/check-dependencies.ps1 | 62 + .../custom/Az.ImportExport.custom.psm1 | 17 + .../custom/Get-AzImportExportBitLockerKey.ps1 | 113 + .../New-AzImportExportDriveListObject.ps1 | 97 + src/ImportExport/custom/readme.md | 41 + .../examples/Get-AzImportExport.md | 40 + .../Get-AzImportExportBitLockerKey.md | 9 + .../examples/Get-AzImportExportLocation.md | 40 + .../examples/New-AzImportExport.md | 10 + .../New-AzImportExportDriveListObject.md | 10 + .../examples/Remove-AzImportExport.md | 14 + .../examples/Update-AzImportExport.md | 19 + src/ImportExport/export-surface.ps1 | 40 + .../exports/Get-AzImportExport.ps1 | 204 ++ .../Get-AzImportExportBitLockerKey.ps1 | 146 ++ .../exports/Get-AzImportExportLocation.ps1 | 177 ++ .../exports/New-AzImportExport.ps1 | 436 +++ .../New-AzImportExportDriveListObject.ps1 | 145 + .../exports/ProxyCmdletDefinitions.ps1 | 1604 ++++++++++++ .../exports/Remove-AzImportExport.ps1 | 176 ++ .../exports/Update-AzImportExport.ps1 | 320 +++ src/ImportExport/exports/readme.md | 20 + src/ImportExport/generate-help.ps1 | 73 + src/ImportExport/generate-info.json | 8 + src/ImportExport/generated/Module.cs | 158 ++ .../generated/api/ImportExport.cs | 1833 +++++++++++++ .../DriveBitLockerKey.PowerShell.cs | 133 + .../DriveBitLockerKey.TypeConverter.cs | 142 + .../Models/Api20161101/DriveBitLockerKey.cs | 63 + .../Api20161101/DriveBitLockerKey.json.cs | 103 + .../Api20161101/DriveStatus.PowerShell.cs | 153 ++ .../Api20161101/DriveStatus.TypeConverter.cs | 142 + .../api/Models/Api20161101/DriveStatus.cs | 254 ++ .../Models/Api20161101/DriveStatus.json.cs | 123 + .../Api20161101/ErrorResponse.PowerShell.cs | 141 + .../ErrorResponse.TypeConverter.cs | 142 + .../api/Models/Api20161101/ErrorResponse.cs | 111 + .../Models/Api20161101/ErrorResponse.json.cs | 101 + .../ErrorResponseError.PowerShell.cs | 139 + .../ErrorResponseError.TypeConverter.cs | 142 + .../Models/Api20161101/ErrorResponseError.cs | 114 + .../Api20161101/ErrorResponseError.json.cs | 117 + ...rrorResponseErrorDetailsItem.PowerShell.cs | 135 + ...rResponseErrorDetailsItem.TypeConverter.cs | 142 + .../ErrorResponseErrorDetailsItem.cs | 77 + .../ErrorResponseErrorDetailsItem.json.cs | 104 + ...ErrorResponseErrorInnererror.PowerShell.cs | 131 + ...orResponseErrorInnererror.TypeConverter.cs | 142 + .../ErrorResponseErrorInnererror.cs | 29 + .../ErrorResponseErrorInnererror.json.cs | 99 + .../Models/Api20161101/Export.PowerShell.cs | 141 + .../Api20161101/Export.TypeConverter.cs | 142 + .../api/Models/Api20161101/Export.cs | 100 + .../api/Models/Api20161101/Export.json.cs | 106 + .../Api20161101/ExportBlobList.PowerShell.cs | 133 + .../ExportBlobList.TypeConverter.cs | 142 + .../api/Models/Api20161101/ExportBlobList.cs | 63 + .../Models/Api20161101/ExportBlobList.json.cs | 119 + .../GetBitLockerKeysResponse.PowerShell.cs | 133 + .../GetBitLockerKeysResponse.TypeConverter.cs | 142 + .../Api20161101/GetBitLockerKeysResponse.cs | 46 + .../GetBitLockerKeysResponse.json.cs | 109 + .../Api20161101/JobDetails.PowerShell.cs | 225 ++ .../Api20161101/JobDetails.TypeConverter.cs | 142 + .../api/Models/Api20161101/JobDetails.cs | 798 ++++++ .../api/Models/Api20161101/JobDetails.json.cs | 141 + .../Api20161101/JobResponse.PowerShell.cs | 237 ++ .../Api20161101/JobResponse.TypeConverter.cs | 142 + .../api/Models/Api20161101/JobResponse.cs | 818 ++++++ .../Models/Api20161101/JobResponse.json.cs | 120 + .../Api20161101/JobResponseTags.PowerShell.cs | 129 + .../JobResponseTags.TypeConverter.cs | 142 + .../api/Models/Api20161101/JobResponseTags.cs | 29 + .../Api20161101/JobResponseTags.json.cs | 99 + .../ListJobsResponse.PowerShell.cs | 133 + .../ListJobsResponse.TypeConverter.cs | 142 + .../Models/Api20161101/ListJobsResponse.cs | 63 + .../Api20161101/ListJobsResponse.json.cs | 111 + .../ListOperationsResponse.PowerShell.cs | 133 + .../ListOperationsResponse.TypeConverter.cs | 142 + .../Api20161101/ListOperationsResponse.cs | 46 + .../ListOperationsResponse.json.cs | 109 + .../Models/Api20161101/Location.PowerShell.cs | 157 ++ .../Api20161101/Location.TypeConverter.cs | 142 + .../api/Models/Api20161101/Location.cs | 274 ++ .../api/Models/Api20161101/Location.json.cs | 107 + .../LocationProperties.PowerShell.cs | 149 ++ .../LocationProperties.TypeConverter.cs | 142 + .../Models/Api20161101/LocationProperties.cs | 235 ++ .../Api20161101/LocationProperties.json.cs | 135 + .../LocationsResponse.PowerShell.cs | 131 + .../LocationsResponse.TypeConverter.cs | 142 + .../Models/Api20161101/LocationsResponse.cs | 46 + .../Api20161101/LocationsResponse.json.cs | 109 + .../Api20161101/Operation.PowerShell.cs | 141 + .../Api20161101/Operation.TypeConverter.cs | 142 + .../api/Models/Api20161101/Operation.cs | 114 + .../api/Models/Api20161101/Operation.json.cs | 103 + .../OperationDisplay.PowerShell.cs | 137 + .../OperationDisplay.TypeConverter.cs | 142 + .../Models/Api20161101/OperationDisplay.cs | 97 + .../Api20161101/OperationDisplay.json.cs | 107 + .../PackageInfomation.PowerShell.cs | 139 + .../PackageInfomation.TypeConverter.cs | 142 + .../Models/Api20161101/PackageInfomation.cs | 99 + .../Api20161101/PackageInfomation.json.cs | 109 + .../PutJobParameters.PowerShell.cs | 231 ++ .../PutJobParameters.TypeConverter.cs | 142 + .../Models/Api20161101/PutJobParameters.cs | 758 ++++++ .../Api20161101/PutJobParameters.json.cs | 105 + .../PutJobParametersTags.PowerShell.cs | 129 + .../PutJobParametersTags.TypeConverter.cs | 142 + .../Api20161101/PutJobParametersTags.cs | 29 + .../Api20161101/PutJobParametersTags.json.cs | 99 + .../Api20161101/ReturnAddress.PowerShell.cs | 147 ++ .../ReturnAddress.TypeConverter.cs | 142 + .../api/Models/Api20161101/ReturnAddress.cs | 188 ++ .../Models/Api20161101/ReturnAddress.json.cs | 117 + .../Api20161101/ReturnShipping.PowerShell.cs | 133 + .../ReturnShipping.TypeConverter.cs | 142 + .../api/Models/Api20161101/ReturnShipping.cs | 63 + .../Models/Api20161101/ReturnShipping.json.cs | 103 + .../ShippingInformation.PowerShell.cs | 147 ++ .../ShippingInformation.TypeConverter.cs | 142 + .../Models/Api20161101/ShippingInformation.cs | 173 ++ .../Api20161101/ShippingInformation.json.cs | 117 + .../UpdateJobParameters.PowerShell.cs | 179 ++ .../UpdateJobParameters.TypeConverter.cs | 142 + .../Models/Api20161101/UpdateJobParameters.cs | 385 +++ .../Api20161101/UpdateJobParameters.json.cs | 103 + ...pdateJobParametersProperties.PowerShell.cs | 177 ++ ...teJobParametersProperties.TypeConverter.cs | 142 + .../UpdateJobParametersProperties.cs | 394 +++ .../UpdateJobParametersProperties.json.cs | 123 + .../UpdateJobParametersTags.PowerShell.cs | 131 + .../UpdateJobParametersTags.TypeConverter.cs | 142 + .../Api20161101/UpdateJobParametersTags.cs | 29 + .../UpdateJobParametersTags.json.cs | 99 + .../Models/ImportExportIdentity.PowerShell.cs | 142 + .../ImportExportIdentity.TypeConverter.cs | 157 ++ .../api/Models/ImportExportIdentity.cs | 122 + .../api/Models/ImportExportIdentity.json.cs | 113 + .../api/Support/DriveState.Completer.cs | 59 + .../api/Support/DriveState.TypeConverter.cs | 59 + .../generated/api/Support/DriveState.cs | 107 + .../GetAzImportExportBitLockerKey_List.cs | 419 +++ .../cmdlets/GetAzImportExportLocation_Get.cs | 381 +++ ...etAzImportExportLocation_GetViaIdentity.cs | 386 +++ .../cmdlets/GetAzImportExportLocation_List.cs | 367 +++ .../cmdlets/GetAzImportExport_Get.cs | 415 +++ .../GetAzImportExport_GetViaIdentity.cs | 391 +++ .../cmdlets/GetAzImportExport_List.cs | 425 +++ .../cmdlets/GetAzImportExport_List1.cs | 441 ++++ .../generated/cmdlets/GetAzOperation_List.cs | 367 +++ .../NewAzImportExport_CreateExpanded.cs | 968 +++++++ .../cmdlets/RemoveAzImportExport_Delete.cs | 422 +++ .../RemoveAzImportExport_DeleteViaIdentity.cs | 401 +++ .../UpdateAzImportExport_UpdateExpanded.cs | 667 +++++ ...zImportExport_UpdateViaIdentityExpanded.cs | 646 +++++ .../generated/runtime/AsyncCommandRuntime.cs | 828 ++++++ .../generated/runtime/AsyncJob.cs | 270 ++ .../runtime/AsyncOperationResponse.cs | 177 ++ .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 99 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 53 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 159 ++ .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 125 + .../BuildTime/Cmdlets/ExportTestStub.cs | 137 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 53 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 121 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 177 ++ .../runtime/BuildTime/Models/PsHelpTypes.cs | 199 ++ .../BuildTime/Models/PsMarkdownTypes.cs | 291 ++ .../BuildTime/Models/PsProxyOutputs.cs | 513 ++++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 499 ++++ .../runtime/BuildTime/PsAttributes.cs | 114 + .../runtime/BuildTime/PsExtensions.cs | 160 ++ .../generated/runtime/BuildTime/PsHelpers.cs | 104 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 249 ++ .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 ++ .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + .../generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 36 + .../generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../generated/runtime/EventListener.cs | 247 ++ src/ImportExport/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + .../generated/runtime/Extensions.cs | 111 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + .../generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 21 + .../generated/runtime/IHeaderSerializable.cs | 14 + .../generated/runtime/ISendAsync.cs | 289 ++ .../generated/runtime/InfoAttribute.cs | 34 + .../generated/runtime/Iso/IsoDate.cs | 214 ++ .../generated/runtime/JsonType.cs | 18 + src/ImportExport/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 68 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 ++ .../generated/runtime/Nodes/JsonNode.cs | 250 ++ .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 ++ .../generated/runtime/Nodes/JsonString.cs | 42 + .../generated/runtime/Nodes/XBinary.cs | 40 + .../generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 ++ .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 ++ .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 254 ++ .../generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 +++ .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 16 + .../runtime/TypeConverterExtensions.cs | 190 ++ .../runtime/UndeclaredResponseException.cs | 104 + .../generated/runtime/Writers/JsonWriter.cs | 223 ++ .../generated/runtime/delegates.cs | 23 + src/ImportExport/help/Az.ImportExport.md | 38 + src/ImportExport/help/Get-AzImportExport.md | 237 ++ .../help/Get-AzImportExportBitLockerKey.md | 126 + .../help/Get-AzImportExportLocation.md | 172 ++ src/ImportExport/help/New-AzImportExport.md | 860 ++++++ .../help/New-AzImportExportDriveListObject.md | 235 ++ .../help/Remove-AzImportExport.md | 216 ++ .../help/Update-AzImportExport.md | 555 ++++ src/ImportExport/how-to.md | 58 + .../internal/Az.ImportExport.internal.psm1 | 38 + .../Get-AzImportExportBitLockerKey.ps1 | 146 ++ src/ImportExport/internal/Get-AzOperation.ps1 | 127 + .../internal/ProxyCmdletDefinitions.ps1 | 273 ++ src/ImportExport/internal/readme.md | 14 + src/ImportExport/pack-module.ps1 | 16 + src/ImportExport/readme.md | 72 + src/ImportExport/run-module.ps1 | 59 + src/ImportExport/test-module.ps1 | 68 + .../test/Get-AzImportExport.Recording.json | 158 ++ .../test/Get-AzImportExport.Tests.ps1 | 35 + ...-AzImportExportBitLockerKey.Recording.json | 41 + .../Get-AzImportExportBitLockerKey.Tests.ps1 | 20 + .../Get-AzImportExportLocation.Recording.json | 119 + .../test/Get-AzImportExportLocation.Tests.ps1 | 30 + .../test/New-AzImportExport.Recording.json | 36 + .../test/New-AzImportExport.Tests.ps1 | 24 + ...ew-AzImportExportDriveListObject.Tests.ps1 | 19 + .../test/Remove-AzImportExport.Recording.json | 146 ++ .../test/Remove-AzImportExport.Tests.ps1 | 32 + .../test/Update-AzImportExport.Recording.json | 70 + .../test/Update-AzImportExport.Tests.ps1 | 28 + .../storage-account/parameters.json | 5 + .../storage-account/template.json | 48 + src/ImportExport/test/env.json | 16 + src/ImportExport/test/loadEnv.ps1 | 28 + src/ImportExport/test/localEnv.json | 16 + src/ImportExport/test/readme.md | 17 + src/ImportExport/test/utils.ps1 | 50 + 728 files changed, 105001 insertions(+) create mode 100644 src/ImageBuilder/Az.ImageBuilder.format.ps1xml create mode 100644 src/ImageBuilder/Az.ImageBuilder.psd1 create mode 100644 src/ImageBuilder/Az.ImageBuilder.psm1 create mode 100644 src/ImageBuilder/MSSharedLibKey.snk create mode 100644 src/ImageBuilder/build-module.ps1 create mode 100644 src/ImageBuilder/check-dependencies.ps1 create mode 100644 src/ImageBuilder/custom/Az.ImageBuilder.custom.psm1 create mode 100644 src/ImageBuilder/custom/New-AzImageBuilderCustomizerObject.ps1 create mode 100644 src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1 create mode 100644 src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1 create mode 100644 src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/custom/readme.md create mode 100644 src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md create mode 100644 src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md create mode 100644 src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md create mode 100644 src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md create mode 100644 src/ImageBuilder/examples/New-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/export-surface.ps1 create mode 100644 src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1 create mode 100644 src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1 create mode 100644 src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1 create mode 100644 src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1 create mode 100644 src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1 create mode 100644 src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/exports/readme.md create mode 100644 src/ImageBuilder/generate-help.ps1 create mode 100644 src/ImageBuilder/generate-info.json create mode 100644 src/ImageBuilder/generated/Module.cs create mode 100644 src/ImageBuilder/generated/api/ImageBuilder.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.dictionary.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.dictionary.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/InnerError.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/InnerError.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/InnerError.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/InnerError.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Operation.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Operation.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Operation.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Operation.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Resource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Resource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Resource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/Resource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.dictionary.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/SubResource.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/SubResource.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/SubResource.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/SubResource.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.cs create mode 100644 src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.json.cs create mode 100644 src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.PowerShell.cs create mode 100644 src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.cs create mode 100644 src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.json.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningState.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningState.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/ProvisioningState.cs create mode 100644 src/ImageBuilder/generated/api/Support/ResourceIdentityType.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/ResourceIdentityType.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/ResourceIdentityType.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunState.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunState.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunState.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunSubState.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunSubState.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/RunSubState.cs create mode 100644 src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.Completer.cs create mode 100644 src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.TypeConverter.cs create mode 100644 src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_Get.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_GetViaIdentity.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_List.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_Get.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_GetViaIdentity.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List1.cs create mode 100644 src/ImageBuilder/generated/cmdlets/GetAzOperation_List.cs create mode 100644 src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_Create.cs create mode 100644 src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_CreateViaIdentity.cs create mode 100644 src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_Delete.cs create mode 100644 src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_DeleteViaIdentity.cs create mode 100644 src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_Run.cs create mode 100644 src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_RunViaIdentity.cs create mode 100644 src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_Cancel.cs create mode 100644 src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_CancelViaIdentity.cs create mode 100644 src/ImageBuilder/generated/runtime/AsyncCommandRuntime.cs create mode 100644 src/ImageBuilder/generated/runtime/AsyncJob.cs create mode 100644 src/ImageBuilder/generated/runtime/AsyncOperationResponse.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/CmdInfoHandler.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/ConversionException.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/JsonConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 src/ImageBuilder/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonArray.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonNode.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonNumber.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonObject.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/JsonString.cs create mode 100644 src/ImageBuilder/generated/runtime/Customizations/XNodeArray.cs create mode 100644 src/ImageBuilder/generated/runtime/Debugging.cs create mode 100644 src/ImageBuilder/generated/runtime/DictionaryExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/EventData.cs create mode 100644 src/ImageBuilder/generated/runtime/EventDataExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/EventListener.cs create mode 100644 src/ImageBuilder/generated/runtime/Events.cs create mode 100644 src/ImageBuilder/generated/runtime/EventsExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/Extensions.cs create mode 100644 src/ImageBuilder/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/Helpers/Seperator.cs create mode 100644 src/ImageBuilder/generated/runtime/Helpers/TypeDetails.cs create mode 100644 src/ImageBuilder/generated/runtime/Helpers/XHelper.cs create mode 100644 src/ImageBuilder/generated/runtime/HttpPipeline.cs create mode 100644 src/ImageBuilder/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 src/ImageBuilder/generated/runtime/IAssociativeArray.cs create mode 100644 src/ImageBuilder/generated/runtime/IHeaderSerializable.cs create mode 100644 src/ImageBuilder/generated/runtime/ISendAsync.cs create mode 100644 src/ImageBuilder/generated/runtime/InfoAttribute.cs create mode 100644 src/ImageBuilder/generated/runtime/Iso/IsoDate.cs create mode 100644 src/ImageBuilder/generated/runtime/JsonType.cs create mode 100644 src/ImageBuilder/generated/runtime/Method.cs create mode 100644 src/ImageBuilder/generated/runtime/Models/JsonMember.cs create mode 100644 src/ImageBuilder/generated/runtime/Models/JsonModel.cs create mode 100644 src/ImageBuilder/generated/runtime/Models/JsonModelCache.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/Collections/XList.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonDate.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonNode.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonNumber.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonObject.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/JsonString.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/XBinary.cs create mode 100644 src/ImageBuilder/generated/runtime/Nodes/XNull.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/JsonParser.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/JsonToken.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/Location.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 src/ImageBuilder/generated/runtime/Parser/TokenReader.cs create mode 100644 src/ImageBuilder/generated/runtime/PipelineMocking.cs create mode 100644 src/ImageBuilder/generated/runtime/Response.cs create mode 100644 src/ImageBuilder/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 src/ImageBuilder/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 src/ImageBuilder/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 src/ImageBuilder/generated/runtime/SerializationMode.cs create mode 100644 src/ImageBuilder/generated/runtime/TypeConverterExtensions.cs create mode 100644 src/ImageBuilder/generated/runtime/UndeclaredResponseException.cs create mode 100644 src/ImageBuilder/generated/runtime/Writers/JsonWriter.cs create mode 100644 src/ImageBuilder/generated/runtime/delegates.cs create mode 100644 src/ImageBuilder/help/Az.ImageBuilder.md create mode 100644 src/ImageBuilder/help/Get-AzImageBuilderRunOutput.md create mode 100644 src/ImageBuilder/help/Get-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/help/New-AzImageBuilderCustomizerObject.md create mode 100644 src/ImageBuilder/help/New-AzImageBuilderDistributorObject.md create mode 100644 src/ImageBuilder/help/New-AzImageBuilderSourceObject.md create mode 100644 src/ImageBuilder/help/New-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/help/Remove-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/help/Start-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/help/Stop-AzImageBuilderTemplate.md create mode 100644 src/ImageBuilder/how-to.md create mode 100644 src/ImageBuilder/internal/Az.ImageBuilder.internal.psm1 create mode 100644 src/ImageBuilder/internal/Get-AzOperation.ps1 create mode 100644 src/ImageBuilder/internal/New-AzImageBuilderTemplate.ps1 create mode 100644 src/ImageBuilder/internal/ProxyCmdletDefinitions.ps1 create mode 100644 src/ImageBuilder/internal/readme.md create mode 100644 src/ImageBuilder/pack-module.ps1 create mode 100644 src/ImageBuilder/readme.md create mode 100644 src/ImageBuilder/run-module.ps1 create mode 100644 src/ImageBuilder/test-module.ps1 create mode 100644 src/ImageBuilder/test/Az.ImageBuilder-TestResults.xml create mode 100644 src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Recording.json create mode 100644 src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Tests.ps1 create mode 100644 src/ImageBuilder/test/Get-AzImageBuilderTemplate.Recording.json create mode 100644 src/ImageBuilder/test/Get-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/New-AzImageBuilderCustomizerObject.Tests.ps1 create mode 100644 src/ImageBuilder/test/New-AzImageBuilderDistributorObject.Tests.ps1 create mode 100644 src/ImageBuilder/test/New-AzImageBuilderSourceObject.Tests.ps1 create mode 100644 src/ImageBuilder/test/New-AzImageBuilderTemplate.Recording.json create mode 100644 src/ImageBuilder/test/New-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Recording.json create mode 100644 src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/Start-AzImageBuilderTemplate.Recording.json create mode 100644 src/ImageBuilder/test/Start-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Recording.json create mode 100644 src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/Update-AzImageBuilderTemplate.Tests.ps1 create mode 100644 src/ImageBuilder/test/Update-AzImageBuilderTemplate.skip.ps1 create mode 100644 src/ImageBuilder/test/deployment-templates/managed-image/parameters.json create mode 100644 src/ImageBuilder/test/deployment-templates/managed-image/template.json create mode 100644 src/ImageBuilder/test/deployment-templates/shared-image/parameters.json create mode 100644 src/ImageBuilder/test/deployment-templates/shared-image/template.json create mode 100644 src/ImageBuilder/test/env.json create mode 100644 src/ImageBuilder/test/loadEnv.ps1 create mode 100644 src/ImageBuilder/test/readme.md create mode 100644 src/ImageBuilder/test/utils.ps1 create mode 100644 src/ImportExport/Az.ImportExport.format.ps1xml create mode 100644 src/ImportExport/Az.ImportExport.psd1 create mode 100644 src/ImportExport/Az.ImportExport.psm1 create mode 100644 src/ImportExport/MSSharedLibKey.snk create mode 100644 src/ImportExport/build-module.ps1 create mode 100644 src/ImportExport/check-dependencies.ps1 create mode 100644 src/ImportExport/custom/Az.ImportExport.custom.psm1 create mode 100644 src/ImportExport/custom/Get-AzImportExportBitLockerKey.ps1 create mode 100644 src/ImportExport/custom/New-AzImportExportDriveListObject.ps1 create mode 100644 src/ImportExport/custom/readme.md create mode 100644 src/ImportExport/examples/Get-AzImportExport.md create mode 100644 src/ImportExport/examples/Get-AzImportExportBitLockerKey.md create mode 100644 src/ImportExport/examples/Get-AzImportExportLocation.md create mode 100644 src/ImportExport/examples/New-AzImportExport.md create mode 100644 src/ImportExport/examples/New-AzImportExportDriveListObject.md create mode 100644 src/ImportExport/examples/Remove-AzImportExport.md create mode 100644 src/ImportExport/examples/Update-AzImportExport.md create mode 100644 src/ImportExport/export-surface.ps1 create mode 100644 src/ImportExport/exports/Get-AzImportExport.ps1 create mode 100644 src/ImportExport/exports/Get-AzImportExportBitLockerKey.ps1 create mode 100644 src/ImportExport/exports/Get-AzImportExportLocation.ps1 create mode 100644 src/ImportExport/exports/New-AzImportExport.ps1 create mode 100644 src/ImportExport/exports/New-AzImportExportDriveListObject.ps1 create mode 100644 src/ImportExport/exports/ProxyCmdletDefinitions.ps1 create mode 100644 src/ImportExport/exports/Remove-AzImportExport.ps1 create mode 100644 src/ImportExport/exports/Update-AzImportExport.ps1 create mode 100644 src/ImportExport/exports/readme.md create mode 100644 src/ImportExport/generate-help.ps1 create mode 100644 src/ImportExport/generate-info.json create mode 100644 src/ImportExport/generated/Module.cs create mode 100644 src/ImportExport/generated/api/ImportExport.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveStatus.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveStatus.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveStatus.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/DriveStatus.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Export.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Export.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Export.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Export.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobDetails.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobDetails.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobDetails.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobDetails.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Location.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Location.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Location.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Location.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationProperties.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationProperties.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationProperties.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationProperties.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Operation.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Operation.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Operation.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/Operation.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.json.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.cs create mode 100644 src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.json.cs create mode 100644 src/ImportExport/generated/api/Models/ImportExportIdentity.PowerShell.cs create mode 100644 src/ImportExport/generated/api/Models/ImportExportIdentity.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Models/ImportExportIdentity.cs create mode 100644 src/ImportExport/generated/api/Models/ImportExportIdentity.json.cs create mode 100644 src/ImportExport/generated/api/Support/DriveState.Completer.cs create mode 100644 src/ImportExport/generated/api/Support/DriveState.TypeConverter.cs create mode 100644 src/ImportExport/generated/api/Support/DriveState.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExportBitLockerKey_List.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExportLocation_Get.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExportLocation_GetViaIdentity.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExportLocation_List.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExport_Get.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExport_GetViaIdentity.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExport_List.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzImportExport_List1.cs create mode 100644 src/ImportExport/generated/cmdlets/GetAzOperation_List.cs create mode 100644 src/ImportExport/generated/cmdlets/NewAzImportExport_CreateExpanded.cs create mode 100644 src/ImportExport/generated/cmdlets/RemoveAzImportExport_Delete.cs create mode 100644 src/ImportExport/generated/cmdlets/RemoveAzImportExport_DeleteViaIdentity.cs create mode 100644 src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateExpanded.cs create mode 100644 src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateViaIdentityExpanded.cs create mode 100644 src/ImportExport/generated/runtime/AsyncCommandRuntime.cs create mode 100644 src/ImportExport/generated/runtime/AsyncJob.cs create mode 100644 src/ImportExport/generated/runtime/AsyncOperationResponse.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 src/ImportExport/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 src/ImportExport/generated/runtime/CmdInfoHandler.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/ConversionException.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/JsonConverter.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 src/ImportExport/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonArray.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonNode.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonNumber.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonObject.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/JsonString.cs create mode 100644 src/ImportExport/generated/runtime/Customizations/XNodeArray.cs create mode 100644 src/ImportExport/generated/runtime/Debugging.cs create mode 100644 src/ImportExport/generated/runtime/DictionaryExtensions.cs create mode 100644 src/ImportExport/generated/runtime/EventData.cs create mode 100644 src/ImportExport/generated/runtime/EventDataExtensions.cs create mode 100644 src/ImportExport/generated/runtime/EventListener.cs create mode 100644 src/ImportExport/generated/runtime/Events.cs create mode 100644 src/ImportExport/generated/runtime/EventsExtensions.cs create mode 100644 src/ImportExport/generated/runtime/Extensions.cs create mode 100644 src/ImportExport/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 src/ImportExport/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 src/ImportExport/generated/runtime/Helpers/Seperator.cs create mode 100644 src/ImportExport/generated/runtime/Helpers/TypeDetails.cs create mode 100644 src/ImportExport/generated/runtime/Helpers/XHelper.cs create mode 100644 src/ImportExport/generated/runtime/HttpPipeline.cs create mode 100644 src/ImportExport/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 src/ImportExport/generated/runtime/IAssociativeArray.cs create mode 100644 src/ImportExport/generated/runtime/IHeaderSerializable.cs create mode 100644 src/ImportExport/generated/runtime/ISendAsync.cs create mode 100644 src/ImportExport/generated/runtime/InfoAttribute.cs create mode 100644 src/ImportExport/generated/runtime/Iso/IsoDate.cs create mode 100644 src/ImportExport/generated/runtime/JsonType.cs create mode 100644 src/ImportExport/generated/runtime/Method.cs create mode 100644 src/ImportExport/generated/runtime/Models/JsonMember.cs create mode 100644 src/ImportExport/generated/runtime/Models/JsonModel.cs create mode 100644 src/ImportExport/generated/runtime/Models/JsonModelCache.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/Collections/XList.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonDate.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonNode.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonNumber.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonObject.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/JsonString.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/XBinary.cs create mode 100644 src/ImportExport/generated/runtime/Nodes/XNull.cs create mode 100644 src/ImportExport/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 src/ImportExport/generated/runtime/Parser/JsonParser.cs create mode 100644 src/ImportExport/generated/runtime/Parser/JsonToken.cs create mode 100644 src/ImportExport/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 src/ImportExport/generated/runtime/Parser/Location.cs create mode 100644 src/ImportExport/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 src/ImportExport/generated/runtime/Parser/TokenReader.cs create mode 100644 src/ImportExport/generated/runtime/PipelineMocking.cs create mode 100644 src/ImportExport/generated/runtime/Response.cs create mode 100644 src/ImportExport/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 src/ImportExport/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 src/ImportExport/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 src/ImportExport/generated/runtime/SerializationMode.cs create mode 100644 src/ImportExport/generated/runtime/TypeConverterExtensions.cs create mode 100644 src/ImportExport/generated/runtime/UndeclaredResponseException.cs create mode 100644 src/ImportExport/generated/runtime/Writers/JsonWriter.cs create mode 100644 src/ImportExport/generated/runtime/delegates.cs create mode 100644 src/ImportExport/help/Az.ImportExport.md create mode 100644 src/ImportExport/help/Get-AzImportExport.md create mode 100644 src/ImportExport/help/Get-AzImportExportBitLockerKey.md create mode 100644 src/ImportExport/help/Get-AzImportExportLocation.md create mode 100644 src/ImportExport/help/New-AzImportExport.md create mode 100644 src/ImportExport/help/New-AzImportExportDriveListObject.md create mode 100644 src/ImportExport/help/Remove-AzImportExport.md create mode 100644 src/ImportExport/help/Update-AzImportExport.md create mode 100644 src/ImportExport/how-to.md create mode 100644 src/ImportExport/internal/Az.ImportExport.internal.psm1 create mode 100644 src/ImportExport/internal/Get-AzImportExportBitLockerKey.ps1 create mode 100644 src/ImportExport/internal/Get-AzOperation.ps1 create mode 100644 src/ImportExport/internal/ProxyCmdletDefinitions.ps1 create mode 100644 src/ImportExport/internal/readme.md create mode 100644 src/ImportExport/pack-module.ps1 create mode 100644 src/ImportExport/readme.md create mode 100644 src/ImportExport/run-module.ps1 create mode 100644 src/ImportExport/test-module.ps1 create mode 100644 src/ImportExport/test/Get-AzImportExport.Recording.json create mode 100644 src/ImportExport/test/Get-AzImportExport.Tests.ps1 create mode 100644 src/ImportExport/test/Get-AzImportExportBitLockerKey.Recording.json create mode 100644 src/ImportExport/test/Get-AzImportExportBitLockerKey.Tests.ps1 create mode 100644 src/ImportExport/test/Get-AzImportExportLocation.Recording.json create mode 100644 src/ImportExport/test/Get-AzImportExportLocation.Tests.ps1 create mode 100644 src/ImportExport/test/New-AzImportExport.Recording.json create mode 100644 src/ImportExport/test/New-AzImportExport.Tests.ps1 create mode 100644 src/ImportExport/test/New-AzImportExportDriveListObject.Tests.ps1 create mode 100644 src/ImportExport/test/Remove-AzImportExport.Recording.json create mode 100644 src/ImportExport/test/Remove-AzImportExport.Tests.ps1 create mode 100644 src/ImportExport/test/Update-AzImportExport.Recording.json create mode 100644 src/ImportExport/test/Update-AzImportExport.Tests.ps1 create mode 100644 src/ImportExport/test/deployment-templates/storage-account/parameters.json create mode 100644 src/ImportExport/test/deployment-templates/storage-account/template.json create mode 100644 src/ImportExport/test/env.json create mode 100644 src/ImportExport/test/loadEnv.ps1 create mode 100644 src/ImportExport/test/localEnv.json create mode 100644 src/ImportExport/test/readme.md create mode 100644 src/ImportExport/test/utils.ps1 diff --git a/src/ImageBuilder/Az.ImageBuilder.format.ps1xml b/src/ImageBuilder/Az.ImageBuilder.format.ps1xml new file mode 100644 index 000000000000..a2da24e8289d --- /dev/null +++ b/src/ImageBuilder/Az.ImageBuilder.format.ps1xml @@ -0,0 +1,1283 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ImageBuilderIdentity + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ImageBuilderIdentity + + + + + + + + + + + + + + + + + + + + + ImageTemplateName + + + ResourceGroupName + + + RunOutputName + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties + + + + + + + + + + + + + + + ClientId + + + PrincipalId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate + + + + + + + + + + + + + + + + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor + + + + + + + + + + + + + + + RunOutputName + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Type + + + Destination + + + Sha256Checksum + + + SourceUri + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity + + + + + + + + + + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus + + + + + + + + + + + + + + + + + + + + + + + + EndTime + + + Message + + + RunState + + + RunSubState + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor + + + + + + + + + + + + + + + + + + + + + RunOutputName + + + Type + + + ImageId + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource + + + + + + + + + + + + + + + Type + + + ImageId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource + + + + + + + + + + + + + + + + + + + + + + + + Type + + + Offer + + + Publisher + + + Sku + + + Version + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Type + + + Inline + + + RunElevated + + + ScriptUri + + + Sha256Checksum + + + ValidExitCode + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties + + + + + + + + + + + + + + + BuildTimeoutInMinute + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Type + + + RestartCheckCommand + + + RestartCommand + + + RestartTimeout + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor + + + + + + + + + + + + + + + + + + + + + + + + + + + RunOutputName + + + Type + + + ExcludeFromLatest + + + GalleryImageId + + + ReplicationRegion + + + StorageAccountType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource + + + + + + + + + + + + + + + Type + + + ImageVersionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Type + + + Inline + + + ScriptUri + + + Sha256Checksum + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource + + + + + + + + + + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor + + + + + + + + + + + + + + + RunOutputName + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile + + + + + + + + + + + + + + + OSDiskSizeGb + + + VMSize + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer + + + + + + + + + + + + + + + + + + + + + + + + Name + + + Type + + + Filter + + + SearchCriterion + + + UpdateLimit + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError + + + + + + + + + + + + + + + ErrorDetail + + + ExceptionType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Operation + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Operation + + + + + + + + + + + + + + + + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + + + + + + + + + + + + + + + + + + PlanName + + + PlanProduct + + + PlanPublisher + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError + + + + + + + + + + + + + + + Code + + + Message + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource + + + + + + + + + + + + + + + + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties + + + + + + + + + + + + + + + + + + ArtifactId + + + ArtifactUri + + + ProvisioningState + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig + + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig + + + + + + + + + + + + SubnetId + + + + + + + + \ No newline at end of file diff --git a/src/ImageBuilder/Az.ImageBuilder.psd1 b/src/ImageBuilder/Az.ImageBuilder.psd1 new file mode 100644 index 000000000000..59f60acbe6ac --- /dev/null +++ b/src/ImageBuilder/Az.ImageBuilder.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = 'bdedc683-d9b6-41ea-b310-d068b8c72305' + RootModule = './Az.ImageBuilder.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: ImageBuilder cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.ImageBuilder.private.dll' + FormatsToProcess = './Az.ImageBuilder.format.ps1xml' + FunctionsToExport = 'Get-AzImageBuilderRunOutput', 'Get-AzImageBuilderTemplate', 'New-AzImageBuilderCustomizerObject', 'New-AzImageBuilderDistributorObject', 'New-AzImageBuilderSourceObject', 'New-AzImageBuilderTemplate', 'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate', 'Stop-AzImageBuilderTemplate', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'ImageBuilder' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/ImageBuilder/Az.ImageBuilder.psm1 b/src/ImageBuilder/Az.ImageBuilder.psm1 new file mode 100644 index 000000000000..274a190a9799 --- /dev/null +++ b/src/ImageBuilder/Az.ImageBuilder.psm1 @@ -0,0 +1,109 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # + # Copyright Microsoft Corporation + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # http://www.apache.org/licenses/LICENSE-2.0 + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImageBuilder.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.ImageBuilder.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/ImageBuilder/MSSharedLibKey.snk b/src/ImageBuilder/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ +function New-AzImageBuilderCustomizerObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer')] + [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ShellCustomizer")] + Param( + #region CustomizerCommon + [Parameter(Mandatory, HelpMessage="Friendly Name to provide context on what this customization step does.")] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${CustomizerName}, + [Parameter(ParameterSetName='ShellCustomizer', HelpMessage="Array of shell commands to execute.")] + [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="Array of shell commands to execute.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string[]] + ${Inline}, + [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc.")] + [Parameter(ParameterSetName='ShellCustomizer', HelpMessage="URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${ScriptUri}, + [Parameter(ParameterSetName='ShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")] + [Parameter(ParameterSetName='FileCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")] + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory, HelpMessage="SHA256 checksum of the shell script provided in the scriptUri field.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Sha256Checksum}, + #endregion CustomizerCommon + + #region FileCustomizer + [Parameter(ParameterSetName='FileCustomizer', Mandatory, HelpMessage="Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${FileCustomizer}, + [Parameter(ParameterSetName='FileCustomizer', HelpMessage="The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Destination}, + [Parameter(ParameterSetName='FileCustomizer', HelpMessage="The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${SourceUri}, + #endregion FileCustomizer + + #region ShellCustomizer + [Parameter(ParameterSetName='ShellCustomizer', Mandatory, HelpMessage="Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${ShellCustomizer}, + #endregion ShellCustomizer + + #region PowerShellCustomizer + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory, HelpMessage="Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' or 'inline' can be specified.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${PowerShellCustomizer}, + [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="If specified, the PowerShell script will be run with elevated privileges.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Boolean] + ${RunElevated}, + [Parameter(ParameterSetName='PowerShellCustomizer', HelpMessage="Valid exit codes for the PowerShell script. [Default: 0].")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [int[]] + ${ValidExitCode}, + #endregion PowerShellCustomizer + + #region WindowsUpdateCustomizer + [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory, HelpMessage="Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${WindowsUpdateCustomizer}, + [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string[]] + ${Filter}, + [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${SearchCriterion}, + [Parameter(ParameterSetName='WindowsUpdateCustomizer', HelpMessage="Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [int] + ${UpdateLimit}, + #endregion WindowsUpdateCustomizer + + #region RestartCustomizer + [Parameter(ParameterSetName='RestartCustomizer', Mandatory, HelpMessage="Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${RestartCustomizer}, + [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Command to check if restart succeeded [Default: ''].")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${RestartCheckCommand}, + [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart']")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${RestartCommand}, + [Parameter(ParameterSetName='RestartCustomizer', HelpMessage="Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'].")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${RestartTimeout} + #endregion RestartCustomizer + ) + + process { + if ($PSBoundParameters.ContainsKey('PowerShellCustomizer')) { + $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePowerShellCustomizer]::New() + $Customizer.Type = "PowerShell" + $Customizer.Inline = $Inline + $Customizer.RunElevated = $RunElevated + $Customizer.ScriptUri = $ScriptUri + $Customizer.Sha256Checksum = $Sha256Checksum + $Customizer.ValidExitCode = $ValidExitCode + } elseif ($PSBoundParameters.ContainsKey('RestartCustomizer')) { + $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateRestartCustomizer]::New() + $Customizer.Type = "WindowsRestart" + $Customizer.RestartCheckCommand = $RestartCheckCommand + $Customizer.RestartCommand = $RestartCommand + $Customizer.RestartTimeout = $RestartTimeout + } elseif ($PSBoundParameters.ContainsKey('WindowsUpdateCustomizer')) { + $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateWindowsUpdateCustomizer]::New() + $Customizer.Type = "WindowsUpdate" + $Customizer.Filter = $Filter + $Customizer.SearchCriterion = $SearchCriterion + $Customizer.UpdateLimit = $UpdateLimit + } elseif ($PSBoundParameters.ContainsKey('ShellCustomizer')) { + $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateShellCustomizer]::New() + $Customizer.Type = "Shell" + $Customizer.Inline = $Inline + $Customizer.ScriptUri = $ScriptUri + $Customizer.Sha256Checksum = $Sha256Checksum + } elseif ($PSBoundParameters.ContainsKey('FileCustomizer')) { + $Customizer = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateFileCustomizer]::New() + $Customizer.Type = "File" + $Customizer.Destination = $Destination + $Customizer.Sha256Checksum = $Sha256Checksum + $Customizer.SourceUri = $SourceUri + } + $Customizer.Name = $CustomizerName + + return $Customizer + } +} \ No newline at end of file diff --git a/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1 b/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1 new file mode 100644 index 000000000000..ac2f1aa650ef --- /dev/null +++ b/src/ImageBuilder/custom/New-AzImageBuilderDistributorObject.ps1 @@ -0,0 +1,109 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Generic distribution object +.Description +Generic distribution object + +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject +#> +function New-AzImageBuilderDistributorObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor')] + [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ManagedImageDistributor")] + Param( + #region DistributorCommon + [Parameter(Mandatory, HelpMessage="Tags that will be applied to the artifact once it has been created/updated by the distributor.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Collections.Hashtable] + ${ArtifactTag}, + [Parameter(Mandatory, HelpMessage="The name to be used for the associated RunOutput.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${RunOutputName}, + #endregion DistributorCommon + + + #region VhdDistributor + [Parameter(ParameterSetName='VhdDistributor', Mandatory, HelpMessage="Distribute via VHD in a storage account.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${VhdDistributor}, + #endregion VhdDistributor + + #region ManagedImageDistributor + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Distribute as a Managed Disk Image.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${ManagedImageDistributor}, + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Resource Id of the Managed Disk Image.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${ImageId}, + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory, HelpMessage="Azure location for the image, should match if image already exists.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Location}, + #endregion ManagedImageDistributor + + #region SharedImageDistributor + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Distribute via Shared Image Gallery.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${SharedImageDistributor}, + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Boolean] + ${ExcludeFromLatest}, + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="A list of regions that the image will be replicated to.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string[]] + ${ReplicationRegion}, + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory, HelpMessage="Resource Id of the Shared Image Gallery image.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${GalleryImageId}, + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])] + [Parameter(ParameterSetName='SharedImageDistributor', HelpMessage="Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType] + ${StorageAccountType} + #endregion SharedImageDistributor + ) + + process { + if ($PSBoundParameters.ContainsKey('VhdDistributor')) { + $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVhdDistributor]::New() + $Distributor.Type = "VHD" + } elseif ($PSBoundParameters.ContainsKey('ManagedImageDistributor')) { + $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageDistributor]::New() + $Distributor.Type = "ManagedImage" + $Distributor.ImageId = $ImageId + $Distributor.Location = $Location + } elseif ($PSBoundParameters.ContainsKey('SharedImageDistributor')) { + $Distributor = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageDistributor]::New() + $Distributor.Type = "SharedImage" + $Distributor.ExcludeFromLatest = $ExcludeFromLatest + $Distributor.GalleryImageId = $GalleryImageId + $Distributor.ReplicationRegion = $ReplicationRegion + $Distributor.StorageAccountType = $StorageAccountType + } + $Distributor.ArtifactTag = $ArtifactTag + $Distributor.RunOutputName = $RunOutputName + + return $Distributor + } +} \ No newline at end of file diff --git a/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1 b/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1 new file mode 100644 index 000000000000..790927a4bd4a --- /dev/null +++ b/src/ImageBuilder/custom/New-AzImageBuilderSourceObject.ps1 @@ -0,0 +1,117 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Describes a virtual machine image source for building, customizing and distributing. +.Description +Describes a virtual machine image source for building, customizing and distributing. + +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject +#> +function New-AzImageBuilderSourceObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource')] + [CmdletBinding(PositionalBinding=$false, DefaultParameterSetName="ManagedImage")] + Param( + #region SourceType-PlatformImage + [Parameter(ParameterSetName='PlatformImage', Mandatory, HelpMessage="Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${SourceTypePlatformImage}, + [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Offer}, + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Name of the purchase plan.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${PlanName}, + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Product of the purchase plan.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${PlanProduct}, + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory, HelpMessage="Publisher of the purchase plan.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${PlanPublisher}, + [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Publisher}, + [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Sku}, + [Parameter(ParameterSetName='PlatformImage', HelpMessage="Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Parameter(ParameterSetName='PlatformImagePlanInfo', HelpMessage="Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${Version}, + #endregion SourceType-PlatformImage + + #region SourceType-ManagedImage + [Parameter(ParameterSetName='ManagedImage', Mandatory, HelpMessage="Describes an image source that is a managed image in customer subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${SourceTypeManagedImage}, + [Parameter(ParameterSetName='ManagedImage', HelpMessage="ARM resource id of the managed image in customer subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${ImageId}, + #endregion SourceType-ManagedImage + + #region SourceType-SharedImageVersion + [Parameter(ParameterSetName='SharedImageVersion', Mandatory, HelpMessage="Describes an image source that is an image version in a shared image gallery.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Switch] + ${SourceTypeSharedImageVersion}, + [Parameter(ParameterSetName='SharedImageVersion', HelpMessage="ARM resource id of the image version in the shared image gallery.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [string] + ${ImageVersionId} + #endregion SourceType-SharedImageVersion + ) + + + process { + if ($PSBoundParameters.ContainsKey('SourceTypePlatformImage')) { + $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePlatformImageSource]::New() + $Source.Type = "PlatformImage" + $Source.Offer = $Offer + if ($PSBoundParameters.ContainsKey('PlanName')) { + $Source.PlanInfoPlanName = $PlanName + $Source.PlanInfoPlanProduct = $PlanProduct + $Source.PlanInfoPlanPublisher = $PlanPublisher + } + $Source.Publisher = $Publisher + $Source.Sku = $Sku + $Source.Version = $Version + } elseif ($PSBoundParameters.ContainsKey('SourceTypeManagedImage')) { + $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateManagedImageSource]::New() + $Source.Type = "ManagedImage" + $Source.ImageId = $ImageId + } elseif ($PSBoundParameters.ContainsKey('SourceTypeSharedImageVersion')) { + $Source = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSharedImageVersionSource]::New() + $Source.Type = "SharedImageVersion" + $Source.ImageVersionId = $ImageVersionId + } + + return $Source + } +} \ No newline at end of file diff --git a/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1 b/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1 new file mode 100644 index 000000000000..7b240c3fba43 --- /dev/null +++ b/src/ImageBuilder/custom/New-AzImagerBuilderTemplate.ps1 @@ -0,0 +1,319 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a virtual machine image template +.Description +Create a virtual machine image template + +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate +#> +function New-AzImageBuilderTemplate { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] + [CmdletBinding(PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium', DefaultParameterSetName="Name")] + param( + [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the image Template.")] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Name', HelpMessage="Subscription credentials which uniquely identify Microsoft Azure subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(HelpMessage="Resource location.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource location + ${Location}, + + [Parameter(HelpMessage="Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Maximum duration to wait while building the image template. + # Omit or specify 0 to use the default (4 hours). + ${BuildTimeoutInMinute}, + + [Parameter(HelpMessage="Specifies the properties used to describe the customization steps of the image, like Image source etc.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]] + # Specifies the properties used to describe the customization steps of the image, like Image source etc + # To construct, see NOTES section for CUSTOMIZE properties and create a hash table. + ${Customize}, + + [Parameter(Mandatory, HelpMessage="The distribution targets where the image output needs to go to.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]] + # The distribution targets where the image output needs to go to. + # To construct, see NOTES section for DISTRIBUTE properties and create a hash table. + ${Distribute}, + + [Parameter(Mandatory, HelpMessage="Describes a virtual machine image source for building, customizing and distributing.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource] + ${Source}, + + # [Parameter(HelpMessage="The type of identity used for the image template.")] + # [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType])] + # [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + # [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType] + # # The type of identity used for the image template. + # # The type 'None' will remove any identities from the image template. + # ${IdentityType}, + + [Parameter(Mandatory, HelpMessage="The id of user assigned identity.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))] + [System.String] + # The id of user assigned identity. + # The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + ${UserAssignedIdentityId}, + + [Parameter(HelpMessage="End time of the last run (UTC).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # End time of the last run (UTC) + ${LastRunStatusEndTime}, + + [Parameter(HelpMessage="Verbose information about the last run state.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose information about the last run state + ${LastRunStatusMessage}, + + [Parameter(HelpMessage="State of the last run.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState] + # State of the last run + ${LastRunStatusRunState}, + + [Parameter(HelpMessage="Sub-state of the last run.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState] + # Sub-state of the last run + ${LastRunStatusRunSubState}, + + [Parameter(HelpMessage="Start time of the last run (UTC).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # Start time of the last run (UTC) + ${LastRunStatusStartTime}, + + [Parameter(HelpMessage="Error code of the provisioning failure.")] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode] + # Error code of the provisioning failure + ${ProvisioningErrorCode}, + + [Parameter(HelpMessage="Verbose error message about the provisioning failure.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose error message about the provisioning failure + ${ProvisioningErrorMessage}, + + [Parameter(HelpMessage="Resource tags.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))] + [System.Collections.Hashtable] + # Resource tags + ${Tag}, + + [Parameter(HelpMessage="Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Size of the OS disk in GB. + # Omit or specify 0 to use Azure's default OS disk size. + ${VMProfileOsdiskSizeInGb}, + + [Parameter(HelpMessage="Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Size of the virtual machine used to build, customize and capture images. + # Omit or specify empty string to use the default (Standard_D1_v2). + ${VMProfileVmSize}, + + [Parameter(HelpMessage="Resource id of a pre-existing subnet.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource id of a pre-existing subnet. + ${VnetConfigSubnetId}, + + #region HideParameter + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + #endregion HideParameter + ) + + process { + try { + $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate]::New() + + $Parameter.Source = $Source + $Null = $PSBoundParameters.Remove('Source') + + if ($PSBoundParameters.ContainsKey('Location')) { + $Parameter.Location = $Location + $Null = $PSBoundParameters.Remove('Location') + } + if ($PSBoundParameters.ContainsKey('Tag')) { + $Parameter.Tag = $Tag + $Null = $PSBoundParameters.Remove('Tag') + } + if ($PSBoundParameters.ContainsKey('BuildTimeoutInMinute')) { + $Parameter.BuildTimeoutInMinute = $BuildTimeoutInMinute + $Null = $PSBoundParameters.Remove('BuildTimeoutInMinute') + } + if ($PSBoundParameters.ContainsKey('Customize')) { + $Parameter.Customize = $Customize + $Null = $PSBoundParameters.Remove('Customize') + } + if ($PSBoundParameters.ContainsKey('Distribute')) { + $Parameter.Distribute = $Distribute + $Null = $PSBoundParameters.Remove('Distribute') + } + $Parameter.IdentityType = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType]::UserAssigned + $UserAssignedIdentities = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentities]::new() + $UserassignedidentitiesAdditionalproperties = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties](@{}) + $UserAssignedIdentities.Add($UserAssignedIdentityId, $UserassignedidentitiesAdditionalproperties) + $Parameter.IdentityUserAssignedIdentity = $UserAssignedIdentities + $Null = $PSBoundParameters.Remove('UserAssignedIdentityId') + + if ($PSBoundParameters.ContainsKey('LastRunStatus')) { + $Parameter.LastRunStatus = $LastRunStatus + $Null = $PSBoundParameters.Remove('LastRunStatus') + } + if ($PSBoundParameters.ContainsKey('LastRunStatusEndTime')) { + $Parameter.LastRunStatusEndTime = $LastRunStatusEndTime + $Null = $PSBoundParameters.Remove('LastRunStatusEndTime') + } + if ($PSBoundParameters.ContainsKey('LastRunStatusMessage')) { + $Parameter.LastRunStatusMessage = $LastRunStatusMessage + $Null = $PSBoundParameters.Remove('LastRunStatusMessage') + } + if ($PSBoundParameters.ContainsKey('LastRunStatusRunState')) { + $Parameter.LastRunStatusRunState = $LastRunStatusRunState + $Null = $PSBoundParameters.Remove('LastRunStatusRunState') + } + if ($PSBoundParameters.ContainsKey('LastRunStatusRunSubState')) { + $Parameter.LastRunStatusRunSubState = $LastRunStatusRunSubState + $Null = $PSBoundParameters.Remove('LastRunStatusRunSubState') + } + if ($PSBoundParameters.ContainsKey('LastRunStatusStartTime')) { + $Parameter.LastRunStatusStartTime = $LastRunStatusStartTime + $Null = $PSBoundParameters.Remove('LastRunStatusStartTime') + } + if ($PSBoundParameters.ContainsKey('ProvisioningErrorCode')) { + $Parameter.ProvisioningErrorCode = $ProvisioningErrorCode + $Null = $PSBoundParameters.Remove('ProvisioningErrorCode') + } + if ($PSBoundParameters.ContainsKey('ProvisioningState')) { + $Parameter.ProvisioningState = $ProvisioningState + $Null = $PSBoundParameters.Remove('ProvisioningState') + } + if ($PSBoundParameters.ContainsKey('VMProfileOsdiskSizeInGb')) { + $Parameter.VMProfileOsdiskSizeGb = $VMProfileOsdiskSizeInGb + $null = $PSBoundParameters.Remove('VMProfileOsdiskSizeInGb') + } + if ($PSBoundParameters.ContainsKey('VMProfileVmSize')) { + $Parameter.VMProfileVmsize = $VMProfileVmSize + $Null = $PSBoundParameters.Remove('VMProfileVmSize') + } + if ($PSBoundParameters.ContainsKey('VnetConfigSubnetId')) { + $Parameter.VnetConfigSubnetId = $VnetConfigSubnetId + $Null = $PSBoundParameters.Remove('VnetConfigSubnetId') + } + $PSBoundParameters.Add("Parameter", $Parameter) + + Az.ImageBuilder.internal\New-AzImageBuilderTemplate @PSBoundParameters + return $source + } catch { + throw + } + } +} + \ No newline at end of file diff --git a/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..029ffec646e4 --- /dev/null +++ b/src/ImageBuilder/custom/Update-AzImageBuilderTemplate.ps1 @@ -0,0 +1,331 @@ + +# # ---------------------------------------------------------------------------------- +# # +# # Copyright Microsoft Corporation +# # Licensed under the Apache License, Version 2.0 (the "License"); +# # you may not use this file except in compliance with the License. +# # You may obtain a copy of the License at +# # http://www.apache.org/licenses/LICENSE-2.0 +# # Unless required by applicable law or agreed to in writing, software +# # distributed under the License is distributed on an "AS IS" BASIS, +# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# # See the License for the specific language governing permissions and +# # limitations under the License. +# # ---------------------------------------------------------------------------------- + +# <# +# .Synopsis +# Update a virtual machine image template +# .Description +# Update a virtual machine image template + +# .Link +# https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/update-AzImageBuilderTemplate +# #> +# function Update-AzImageBuilderTemplate { +# [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +# [CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +# param( +# [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the image Template.")] +# [Alias('Name')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] +# [System.String] +# # The name of the image Template +# ${ImageTemplateName}, + +# [Parameter(ParameterSetName='Name', Mandatory, HelpMessage="The name of the resource group.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] +# [System.String] +# # The name of the resource group. +# ${ResourceGroupName}, + +# [Parameter(ParameterSetName='Name', HelpMessage="Subscription credentials which uniquely identify Microsoft Azure subscription.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] +# [System.String] +# # Subscription credentials which uniquely identify Microsoft Azure subscription. +# # The subscription Id forms part of the URI for every service call. +# ${SubscriptionId}, + +# [Parameter(ParameterSetName='InputObject', Mandatory, ValueFromPipeline, HelpMessage="Identity Parameter.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] +# # Identity Parameter +# # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. +# ${InputObject}, + +# [Parameter(HelpMessage="Resource location.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Resource location +# ${Location}, + +# [Parameter(HelpMessage="Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.Int32] +# # Maximum duration to wait while building the image template. +# # Omit or specify 0 to use the default (4 hours). +# ${BuildTimeoutInMinute}, + +# [Parameter(HelpMessage="Specifies the properties used to describe the customization steps of the image, like Image source etc.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]] +# # Specifies the properties used to describe the customization steps of the image, like Image source etc +# # To construct, see NOTES section for CUSTOMIZE properties and create a hash table. +# ${Customize}, + +# [Parameter(HelpMessage="The distribution targets where the image output needs to go to.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]] +# # The distribution targets where the image output needs to go to. +# # To construct, see NOTES section for DISTRIBUTE properties and create a hash table. +# ${Distribute}, + +# [Parameter(Mandatory, HelpMessage="Describes a virtual machine image source for building, customizing and distributing.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource] +# ${Source}, + +# [Parameter(HelpMessage="The type of identity used for the image template.")] +# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType])] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType] +# # The type of identity used for the image template. +# # The type 'None' will remove any identities from the image template. +# ${IdentityType}, + +# [Parameter(HelpMessage="The list of user identities associated with the image template.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))] +# [System.Collections.Hashtable] +# # The list of user identities associated with the image template. +# # The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. +# ${UserAssignedIdentity}, + +# [Parameter(HelpMessage="End time of the last run (UTC).")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.DateTime] +# # End time of the last run (UTC) +# ${LastRunStatusEndTime}, + +# [Parameter(HelpMessage="Verbose information about the last run state.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Verbose information about the last run state +# ${LastRunStatusMessage}, + +# [Parameter(HelpMessage="State of the last run.")] +# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState] +# # State of the last run +# ${LastRunStatusRunState}, + +# [Parameter(HelpMessage="Sub-state of the last run.")] +# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState] +# # Sub-state of the last run +# ${LastRunStatusRunSubState}, + +# [Parameter(HelpMessage="Start time of the last run (UTC).")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.DateTime] +# # Start time of the last run (UTC) +# ${LastRunStatusStartTime}, + +# [Parameter(HelpMessage="Error code of the provisioning failure.")] +# [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode] +# # Error code of the provisioning failure +# ${ProvisioningErrorCode}, + +# [Parameter(HelpMessage="Verbose error message about the provisioning failure.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Verbose error message about the provisioning failure +# ${ProvisioningErrorMessage}, + +# [Parameter(HelpMessage="Specifies the type of source image you want to start with.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Specifies the type of source image you want to start with. +# ${SourceType}, + +# [Parameter(HelpMessage="Resource tags.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))] +# [System.Collections.Hashtable] +# # Resource tags +# ${Tag}, + +# [Parameter(HelpMessage="Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.Int32] +# # Size of the OS disk in GB. +# # Omit or specify 0 to use Azure's default OS disk size. +# ${VMProfileOsdiskSizeInGb}, + +# [Parameter(HelpMessage="Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Size of the virtual machine used to build, customize and capture images. +# # Omit or specify empty string to use the default (Standard_D1_v2). +# ${VMProfileVmSize}, + +# [Parameter(HelpMessage="Resource id of a pre-existing subnet.")] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] +# [System.String] +# # Resource id of a pre-existing subnet. +# ${VnetConfigSubnetId}, + +# #region HideParameter +# [Parameter()] +# [Alias('AzureRMContext', 'AzureCredential')] +# [ValidateNotNull()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] +# [System.Management.Automation.PSObject] +# # The credentials, account, tenant, and subscription used for communication with Azure. +# ${DefaultProfile}, + +# [Parameter()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Management.Automation.SwitchParameter] +# # Run the command as a job +# ${AsJob}, + +# [Parameter(DontShow)] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Management.Automation.SwitchParameter] +# # Wait for .NET debugger to attach +# ${Break}, + +# [Parameter(DontShow)] +# [ValidateNotNull()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] +# # SendAsync Pipeline Steps to be appended to the front of the pipeline +# ${HttpPipelineAppend}, + +# [Parameter(DontShow)] +# [ValidateNotNull()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] +# # SendAsync Pipeline Steps to be prepended to the front of the pipeline +# ${HttpPipelinePrepend}, + +# [Parameter()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Management.Automation.SwitchParameter] +# # Run the command asynchronously +# ${NoWait}, + +# [Parameter(DontShow)] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Uri] +# # The URI for the proxy server to use +# ${Proxy}, + +# [Parameter(DontShow)] +# [ValidateNotNull()] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Management.Automation.PSCredential] +# # Credentials for a proxy server to use for the remote call +# ${ProxyCredential}, + +# [Parameter(DontShow)] +# [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] +# [System.Management.Automation.SwitchParameter] +# # Use the default credentials for the proxy +# ${ProxyUseDefaultCredentials} +# #endregion HideParameter +# ) + +# process { +# try { +# $Parameter = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate]::New() + +# $Parameter.Source = $Source +# $Null = $PSBoundParameters.Remove('Source') + +# if ($PSBoundParameters.ContainsKey('Location')) { +# $Parameter.Location = $Location +# $Null = $PSBoundParameters.Remove('Location') +# } +# if ($PSBoundParameters.ContainsKey('Tag')) { +# $Parameter.Tag = $Tag +# $Null = $PSBoundParameters.Remove('Tag') +# } +# if ($PSBoundParameters.ContainsKey('BuildTimeoutInMinute')) { +# $Parameter.BuildTimeoutInMinute = $BuildTimeoutInMinute +# $Null = $PSBoundParameters.Remove('BuildTimeoutInMinute') +# } +# if ($PSBoundParameters.ContainsKey('Customize')) { +# $Parameter.Customize = $Customize +# $Null = $PSBoundParameters.Remove('Customize') +# } +# if ($PSBoundParameters.ContainsKey('Distribute')) { +# $Parameter.Distribute = $Distribute +# $Null = $PSBoundParameters.Remove('Distribute') +# } +# if ($PSBoundParameters.ContainsKey('IdentityType')) { +# $Parameter.IdentityType = $IdentityType +# $Null = $PSBoundParameters.Remove('IdentityType') +# } +# if ($PSBoundParameters.ContainsKey('UserAssignedIdentity')) { +# $Parameter.IdentityUserAssignedIdentity = $UserAssignedIdentity +# $Null = $PSBoundParameters.Remove('UserAssignedIdentity') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatus')) { +# $Parameter.LastRunStatus = $LastRunStatus +# $Null = $PSBoundParameters.Remove('LastRunStatus') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatusEndTime')) { +# $Parameter.LastRunStatusEndTime = $LastRunStatusEndTime +# $Null = $PSBoundParameters.Remove('LastRunStatusEndTime') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatusMessage')) { +# $Parameter.LastRunStatusMessage = $LastRunStatusMessage +# $Null = $PSBoundParameters.Remove('LastRunStatusMessage') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatusRunState')) { +# $Parameter.LastRunStatusRunState = $LastRunStatusRunState +# $Null = $PSBoundParameters.Remove('LastRunStatusRunState') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatusRunSubState')) { +# $Parameter.LastRunStatusRunSubState = $LastRunStatusRunSubState +# $Null = $PSBoundParameters.Remove('LastRunStatusRunSubState') +# } +# if ($PSBoundParameters.ContainsKey('LastRunStatusStartTime')) { +# $Parameter.LastRunStatusStartTime = $LastRunStatusStartTime +# $Null = $PSBoundParameters.Remove('LastRunStatusStartTime') +# } +# if ($PSBoundParameters.ContainsKey('ProvisioningErrorCode')) { +# $Parameter.ProvisioningErrorCode = $ProvisioningErrorCode +# $Null = $PSBoundParameters.Remove('ProvisioningErrorCode') +# } +# if ($PSBoundParameters.ContainsKey('ProvisioningState')) { +# $Parameter.ProvisioningState = $ProvisioningState +# $Null = $PSBoundParameters.Remove('ProvisioningState') +# } +# if ($PSBoundParameters.ContainsKey('VMProfileOsdiskSizeInGb')) { +# $Parameter.VMProfileOsdiskSizeGb = $VMProfileOsdiskSizeInGb +# $null = $PSBoundParameters.Remove('VMProfileOsdiskSizeInGb') +# } +# if ($PSBoundParameters.ContainsKey('VMProfileVmSize')) { +# $Parameter.VMProfileVmsize = $VMProfileVmSize +# $Null = $PSBoundParameters.Remove('VMProfileVmSize') +# } +# if ($PSBoundParameters.ContainsKey('VnetConfigSubnetId')) { +# $Parameter.VnetConfigSubnetId = $VnetConfigSubnetId +# $Null = $PSBoundParameters.Remove('VnetConfigSubnetId') +# } +# $PSBoundParameters.Add("Parameter", $Parameter) +# Az.ImageBuilder.internal\Update-AzImageBuilderTemplate @PSBoundParameters +# } catch { +# throw +# } +# } +# } + \ No newline at end of file diff --git a/src/ImageBuilder/custom/readme.md b/src/ImageBuilder/custom/readme.md new file mode 100644 index 000000000000..b896468e0e44 --- /dev/null +++ b/src/ImageBuilder/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.ImageBuilder` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.ImageBuilder.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.ImageBuilder` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.ImageBuilder.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.ImageBuilder.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.ImageBuilder`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ImageBuilder`. +- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ImageBuilder`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md b/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md new file mode 100644 index 000000000000..7464f8304b54 --- /dev/null +++ b/src/ImageBuilder/examples/Get-AzImageBuilderRunOutput.md @@ -0,0 +1,32 @@ +### Example 1: List all run results under a template +```powershell +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Name Type +---- ---- +image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` + +This command lists all run results under a template. + +### Example 2: Get a run result under a template +```powershell +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` +This command gets a run result under a template. + +### Example 3: Get a run result under a template +```powershell +PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx +PS C:\> Get-AzImageBuilderRunOutput -InputObject $result + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` +This command gets a run result under a template. + diff --git a/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..e3afcfa51599 --- /dev/null +++ b/src/ImageBuilder/examples/Get-AzImageBuilderTemplate.md @@ -0,0 +1,55 @@ +### Example 1: List all template under a subscription +```powershell +PS C:\> Get-AzImageBuilderTemplate + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +``` + +This command lists all template under a subscription. + +### Example 2: List all template under a resource group +```powershell +PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +``` + +This command lists all template under a resource group. + +### Example 3: Get a template under a resource group +```powershell +PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +``` + +This command gets a template under a resource group. + +### Example 4: Get a template under a resource group +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v +PS C:\> Get-AzImageBuilderTemplate -InputObject $template + +Location Name Type +-------- ---- ---- +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +``` + +This command gets a template under a resource group. + diff --git a/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md b/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md new file mode 100644 index 000000000000..d5b461385900 --- /dev/null +++ b/src/ImageBuilder/examples/New-AzImageBuilderCustomizerObject.md @@ -0,0 +1,57 @@ +### Example 1: Create a windows update customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate' + +Name Type Filter SearchCriterion UpdateLimit +---- ---- ------ --------------- ----------- +WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100 +``` + +This command creates a windows update customizer. + +### Example 2: Create a file customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + +Name Type Destination Sha256Checksum SourceUri +---- ---- ----------- -------------- --------- +filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html + +``` + +This command creates a file customizer. + +### Example 3: Create a powershell customizer +```powershell +PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt") +PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline + +Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e +---- ---- ------ ----------- --------- -------------- -- +settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +``` + +This command creates a powershell customizer. + +### Example 4: Create a restart customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m' + +Name Type RestartCheckCommand RestartCommand RestartTimeout +---- ---- ------------------- -------------- -------------- +restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m +``` + +This command creates a restart customizer. + +### Example 5: Create a shell customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +Name Type Inline ScriptUri Sha256Checksum +---- ---- ------ --------- -------------- +downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +``` + +This command creates a shell customizer. + diff --git a/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md b/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md new file mode 100644 index 000000000000..2eacd49e27cf --- /dev/null +++ b/src/ImageBuilder/examples/New-AzImageBuilderDistributorObject.md @@ -0,0 +1,35 @@ +### Example 1: Create a managed image distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus + +RunOutputName Type ImageId Location +------------- ---- ------- -------- +luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus +``` + +This command creates a managed image distributor. + +### Example 2: Create a VHD distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd + +RunOutputName Type +------------- ---- +image-vhd Vhd +``` + +This command creates a VHD distributor. + +### Example 3: Create a shared image distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false + +RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi + on +------------- ---- ----------------- -------------- --------------- +outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2} +``` + +This command creates a shared image distributor. + + diff --git a/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md b/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md new file mode 100644 index 000000000000..b7fa532501c5 --- /dev/null +++ b/src/ImageBuilder/examples/New-AzImageBuilderSourceObject.md @@ -0,0 +1,34 @@ +### Example 1: Create a managed image source +```powershell +PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image' +PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid + +Type ImageId +---- ------- +ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image +``` + +This command creates a managed image source. + +### Example 2: Create a shared image source +```powershell +PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 + +Type ImageVersionId +---- -------------- +SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 +``` + +This command creates a shared image source. + +### Example 3: Create a platfrom image source +```powershell +PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' + +Type Offer Publisher Sku Version +---- ----- --------- --- ------- +PlatformImage UbuntuServer Canonical 18.04-LTS latest +``` + +This command creates a platfrom image source. + diff --git a/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..abf1d758fffd --- /dev/null +++ b/src/ImageBuilder/examples/New-AzImageBuilderTemplate.md @@ -0,0 +1,19 @@ +### Example 1: Create a virtual machine image template +```powershell +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan +``` + +This commands creates a virtual machine image template. + diff --git a/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..b82aede7a2d2 --- /dev/null +++ b/src/ImageBuilder/examples/Remove-AzImageBuilderTemplate.md @@ -0,0 +1,17 @@ +### Example 1: Remove a image template +```powershell +PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder + +``` + +This command removes a image template. + +### Example 2: Remove a image template +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder +PS C:\> Remove-AzImageBuilderTemplate -InputObject $template + +``` + +This command removes a image template. + diff --git a/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..8b7d409c0e77 --- /dev/null +++ b/src/ImageBuilder/examples/Start-AzImageBuilderTemplate.md @@ -0,0 +1,17 @@ +### Example 1: Start an image template +```powershell +PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg + +``` + +This command starts an image template. + +### Example 2: Start an image template +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Start-AzImageBuilderTemplate -InputObject $template + +``` + +This command starts an image template. + diff --git a/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md b/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..9da241438e28 --- /dev/null +++ b/src/ImageBuilder/examples/Stop-AzImageBuilderTemplate.md @@ -0,0 +1,30 @@ +### Example 1: Stop image template creation +```powershell +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder + +``` + +This command stops image template creation. + +### Example 2: Stop image template creation +```powershell +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Stop-AzImageBuilderTemplate -InputObject $template + +``` + +This command stops image template creation. + + diff --git a/src/ImageBuilder/export-surface.ps1 b/src/ImageBuilder/export-surface.ps1 new file mode 100644 index 000000000000..e18f61403be3 --- /dev/null +++ b/src/ImageBuilder/export-surface.ps1 @@ -0,0 +1,40 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.ImageBuilder.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.ImageBuilder' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1 b/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1 new file mode 100644 index 000000000000..f0485458e991 --- /dev/null +++ b/src/ImageBuilder/exports/Get-AzImageBuilderRunOutput.ps1 @@ -0,0 +1,186 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the specified run output for the specified image template resource +.Description +Get the specified run output for the specified image template resource +.Example +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Name Type +---- ---- +image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs +.Example +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +.Example +PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx +PS C:\> Get-AzImageBuilderRunOutput -InputObject $result + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuilderrunoutput +#> +function Get-AzImageBuilderRunOutput { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the run output + ${RunOutputName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_Get'; + GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_GetViaIdentity'; + List = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..f27bc0cb9c2a --- /dev/null +++ b/src/ImageBuilder/exports/Get-AzImageBuilderTemplate.ps1 @@ -0,0 +1,198 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get information about a virtual machine image template +.Description +Get information about a virtual machine image template +.Example +PS C:\> Get-AzImageBuilderTemplate + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v +PS C:\> Get-AzImageBuilderTemplate -InputObject $template + +Location Name Type +-------- ---- ---- +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuildertemplate +#> +function Get-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_Get'; + GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_GetViaIdentity'; + List = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List'; + List1 = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1 new file mode 100644 index 000000000000..d9bb62593a9e --- /dev/null +++ b/src/ImageBuilder/exports/New-AzImageBuilderCustomizerObject.ps1 @@ -0,0 +1,237 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Describes a unit of image customization +.Description +Describes a unit of image customization +.Example +PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate' + +Name Type Filter SearchCriterion UpdateLimit +---- ---- ------ --------------- ----------- +WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100 +.Example +PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + +Name Type Destination Sha256Checksum SourceUri +---- ---- ----------- -------------- --------- +filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html + +.Example +PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt") +PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline + +Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e +---- ---- ------ ----------- --------- -------------- -- +settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +.Example +PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m' + +Name Type RestartCheckCommand RestartCommand RestartTimeout +---- ---- ------------------- -------------- -------------- +restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m +.Example +PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +Name Type Inline ScriptUri Sha256Checksum +---- ---- ------ --------- -------------- +downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject +#> +function New-AzImageBuilderCustomizerObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer])] +[CmdletBinding(DefaultParameterSetName='ShellCustomizer', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Friendly Name to provide context on what this customization step does. + ${CustomizerName}, + + [Parameter(ParameterSetName='ShellCustomizer', Mandatory)] + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)] + [Parameter(ParameterSetName='FileCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # SHA256 checksum of the shell script provided in the scriptUri field. + ${Sha256Checksum}, + + [Parameter(ParameterSetName='ShellCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Runs a shell script during the customization phase (Linux). + # Corresponds to Packer shell provisioner. + # Exactly one of 'scriptUri' or 'inline' can be specified. + ${ShellCustomizer}, + + [Parameter(ParameterSetName='ShellCustomizer')] + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # Array of shell commands to execute. + ${Inline}, + + [Parameter(ParameterSetName='ShellCustomizer')] + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # URI of the shell script to be run for customizing. + # It can be a github link, SAS URI for Azure Storage, etc. + ${ScriptUri}, + + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Runs the specified PowerShell on the VM (Windows). + # Corresponds to Packer powershell provisioner. + # Exactly one of 'scriptUri' or 'inline' can be specified. + ${PowerShellCustomizer}, + + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Boolean] + # If specified, the PowerShell script will be run with elevated privileges. + ${RunElevated}, + + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32[]] + # Valid exit codes for the PowerShell script. + # [Default: 0]. + ${ValidExitCode}, + + [Parameter(ParameterSetName='FileCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Uploads files to VMs (Linux, Windows). + # Corresponds to Packer file provisioner. + ${FileCustomizer}, + + [Parameter(ParameterSetName='FileCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM. + ${Destination}, + + [Parameter(ParameterSetName='FileCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The URI of the file to be uploaded for customizing the VM. + # It can be a github link, SAS URI for Azure Storage, etc. + ${SourceUri}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Installs Windows Updates. + # Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update). + ${WindowsUpdateCustomizer}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # Array of filters to select updates to apply. + # Omit or specify empty array to use the default (no filter). + # Refer to above link for examples and detailed description of this field. + ${Filter}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Criteria to search updates. + # Omit or specify empty string to use the default (search all). + # Refer to above link for examples and detailed description of this field. + ${SearchCriterion}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Maximum number of updates to apply at a time. + # Omit or specify 0 to use the default (1000). + ${UpdateLimit}, + + [Parameter(ParameterSetName='RestartCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Reboots a VM and waits for it to come back online (Windows). + # Corresponds to Packer windows-restart provisioner. + ${RestartCustomizer}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Command to check if restart succeeded [Default: '']. + ${RestartCheckCommand}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart'] + ${RestartCommand}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Restart timeout specified as a string of magnitude and unit, e.g. + # '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']. + ${RestartTimeout} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + PowerShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + FileCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + WindowsUpdateCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + RestartCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1 new file mode 100644 index 000000000000..e6a8fdf9196d --- /dev/null +++ b/src/ImageBuilder/exports/New-AzImageBuilderDistributorObject.ps1 @@ -0,0 +1,156 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Generic distribution object +.Description +Generic distribution object +.Example +PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus + +RunOutputName Type ImageId Location +------------- ---- ------- -------- +luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus +.Example +PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd + +RunOutputName Type +------------- ---- +image-vhd Vhd +.Example +PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false + +RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi + on +------------- ---- ----------------- -------------- --------------- +outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject +#> +function New-AzImageBuilderDistributorObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor])] +[CmdletBinding(DefaultParameterSetName='ManagedImageDistributor', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Collections.Hashtable] + # Tags that will be applied to the artifact once it has been created/updated by the distributor. + ${ArtifactTag}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The name to be used for the associated RunOutput. + ${RunOutputName}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute as a Managed Disk Image. + ${ManagedImageDistributor}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource Id of the Managed Disk Image. + ${ImageId}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Azure location for the image, should match if image already exists. + ${Location}, + + [Parameter(ParameterSetName='VhdDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute via VHD in a storage account. + ${VhdDistributor}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute via Shared Image Gallery. + ${SharedImageDistributor}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Boolean] + # Flag that indicates whether created image version should be excluded from latest. + # Omit to use the default (false). + ${ExcludeFromLatest}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # A list of regions that the image will be replicated to. + ${ReplicationRegion}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource Id of the Shared Image Gallery image. + ${GalleryImageId}, + + [Parameter(ParameterSetName='SharedImageDistributor')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType] + # Storage account type to be used to store the shared image. + # Omit to use the default (Standard_LRS). + ${StorageAccountType} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ManagedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + VhdDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + SharedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1 new file mode 100644 index 000000000000..07e928016492 --- /dev/null +++ b/src/ImageBuilder/exports/New-AzImageBuilderSourceObject.ps1 @@ -0,0 +1,165 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Describes a virtual machine image source for building, customizing and distributing. +.Description +Describes a virtual machine image source for building, customizing and distributing. +.Example +PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image' +PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid + +Type ImageId +---- ------- +ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image +.Example +PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 + +Type ImageVersionId +---- -------------- +SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 +.Example +PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' + +Type Offer Publisher Sku Version +---- ----- --------- --- ------- +PlatformImage UbuntuServer Canonical 18.04-LTS latest + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject +#> +function New-AzImageBuilderSourceObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource])] +[CmdletBinding(DefaultParameterSetName='ManagedImage', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='ManagedImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source that is a managed image in customer subscription. + ${SourceTypeManagedImage}, + + [Parameter(ParameterSetName='ManagedImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # ARM resource id of the managed image in customer subscription. + ${ImageId}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Parameter(ParameterSetName='PlatformImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${SourceTypePlatformImage}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Name of the purchase plan. + ${PlanName}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Product of the purchase plan. + ${PlanProduct}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Publisher of the purchase plan. + ${PlanPublisher}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Offer}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Publisher}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Sku}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Version}, + + [Parameter(ParameterSetName='SharedImageVersion', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source that is an image version in a shared image gallery. + ${SourceTypeSharedImageVersion}, + + [Parameter(ParameterSetName='SharedImageVersion')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # ARM resource id of the image version in the shared image gallery. + ${ImageVersionId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ManagedImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + PlatformImagePlanInfo = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + PlatformImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + SharedImageVersion = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..8459e2dd29ff --- /dev/null +++ b/src/ImageBuilder/exports/New-AzImageBuilderTemplate.ps1 @@ -0,0 +1,294 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a virtual machine image template +.Description +Create a virtual machine image template +.Example +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CUSTOMIZE : Specifies the properties used to describe the customization steps of the image, like Image source etc. + Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + [Name ]: Friendly Name to provide context on what this customization step does + +DISTRIBUTE : The distribution targets where the image output needs to go to. + RunOutputName : The name to be used for the associated RunOutput. + Type : Type of distribution. + [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor. + [(Any) ]: This indicates any property can be added to this object. + +SOURCE : Describes a virtual machine image source for building, customizing and distributing. + Type : Specifies the type of source image you want to start with. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate +#> +function New-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template. + ${ImageTemplateName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]] + # The distribution targets where the image output needs to go to. + # To construct, see NOTES section for DISTRIBUTE properties and create a hash table. + ${Distribute}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource] + # Describes a virtual machine image source for building, customizing and distributing. + # To construct, see NOTES section for SOURCE properties and create a hash table. + ${Source}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))] + [System.String] + # The id of user assigned identity. + ${UserAssignedIdentityId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Maximum duration to wait while building the image template. + # Omit or specify 0 to use the default (4 hours). + ${BuildTimeoutInMinute}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]] + # Specifies the properties used to describe the customization steps of the image, like Image source etc. + # To construct, see NOTES section for CUSTOMIZE properties and create a hash table. + ${Customize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # End time of the last run (UTC). + ${LastRunStatusEndTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose information about the last run state. + ${LastRunStatusMessage}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState] + # State of the last run. + ${LastRunStatusRunState}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState] + # Sub-state of the last run. + ${LastRunStatusRunSubState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # Start time of the last run (UTC). + ${LastRunStatusStartTime}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode] + # Error code of the provisioning failure. + ${ProvisioningErrorCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose error message about the provisioning failure. + ${ProvisioningErrorMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Size of the OS disk in GB. + # Omit or specify 0 to use Azure's default OS disk size. + ${VMProfileOsdiskSizeInGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Size of the virtual machine used to build, customize and capture images. + # Omit or specify empty string to use the default (Standard_D1_v2). + ${VMProfileVmSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource id of a pre-existing subnet. + ${VnetConfigSubnetId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # region HideParameter + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + # endregion HideParameter + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Name = 'Az.ImageBuilder.custom\New-AzImageBuilderTemplate'; + } + if (('Name') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1 b/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..40c96ffd42c2 --- /dev/null +++ b/src/ImageBuilder/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,1797 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the specified run output for the specified image template resource +.Description +Get the specified run output for the specified image template resource +.Example +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Name Type +---- ---- +image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs +.Example +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +.Example +PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx +PS C:\> Get-AzImageBuilderRunOutput -InputObject $result + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuilderrunoutput +#> +function Get-AzImageBuilderRunOutput { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the run output + ${RunOutputName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_Get'; + GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_GetViaIdentity'; + List = 'Az.ImageBuilder.private\Get-AzImageBuilderRunOutput_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get information about a virtual machine image template +.Description +Get information about a virtual machine image template +.Example +PS C:\> Get-AzImageBuilderTemplate + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v +PS C:\> Get-AzImageBuilderTemplate -InputObject $template + +Location Name Type +-------- ---- ---- +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuildertemplate +#> +function Get-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_Get'; + GetViaIdentity = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_GetViaIdentity'; + List = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List'; + List1 = 'Az.ImageBuilder.private\Get-AzImageBuilderTemplate_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a virtual machine image template +.Description +Delete a virtual machine image template +.Example +PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder + +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder +PS C:\> Remove-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/remove-azimagebuildertemplate +#> +function Remove-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_Delete'; + DeleteViaIdentity = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create artifacts from a existing image template +.Description +Create artifacts from a existing image template +.Example +PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg + +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Start-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/start-azimagebuildertemplate +#> +function Start-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Run', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Run', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Run', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Run')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RunViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Run = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_Run'; + RunViaIdentity = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_RunViaIdentity'; + } + if (('Run') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Cancel the long running image build based on the image template +.Description +Cancel the long running image build based on the image template +.Example +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder + +.Example +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Stop-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/stop-azimagebuildertemplate +#> +function Stop-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Cancel = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_Cancel'; + CancelViaIdentity = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Describes a unit of image customization +.Description +Describes a unit of image customization +.Example +PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate' + +Name Type Filter SearchCriterion UpdateLimit +---- ---- ------ --------------- ----------- +WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100 +.Example +PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + +Name Type Destination Sha256Checksum SourceUri +---- ---- ----------- -------------- --------- +filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html + +.Example +PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt") +PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline + +Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e +---- ---- ------ ----------- --------- -------------- -- +settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +.Example +PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m' + +Name Type RestartCheckCommand RestartCommand RestartTimeout +---- ---- ------------------- -------------- -------------- +restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m +.Example +PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +Name Type Inline ScriptUri Sha256Checksum +---- ---- ------ --------- -------------- +downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject +#> +function New-AzImageBuilderCustomizerObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer])] +[CmdletBinding(DefaultParameterSetName='ShellCustomizer', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Friendly Name to provide context on what this customization step does. + ${CustomizerName}, + + [Parameter(ParameterSetName='ShellCustomizer', Mandatory)] + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)] + [Parameter(ParameterSetName='FileCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # SHA256 checksum of the shell script provided in the scriptUri field. + ${Sha256Checksum}, + + [Parameter(ParameterSetName='ShellCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Runs a shell script during the customization phase (Linux). + # Corresponds to Packer shell provisioner. + # Exactly one of 'scriptUri' or 'inline' can be specified. + ${ShellCustomizer}, + + [Parameter(ParameterSetName='ShellCustomizer')] + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # Array of shell commands to execute. + ${Inline}, + + [Parameter(ParameterSetName='ShellCustomizer')] + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # URI of the shell script to be run for customizing. + # It can be a github link, SAS URI for Azure Storage, etc. + ${ScriptUri}, + + [Parameter(ParameterSetName='PowerShellCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Runs the specified PowerShell on the VM (Windows). + # Corresponds to Packer powershell provisioner. + # Exactly one of 'scriptUri' or 'inline' can be specified. + ${PowerShellCustomizer}, + + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Boolean] + # If specified, the PowerShell script will be run with elevated privileges. + ${RunElevated}, + + [Parameter(ParameterSetName='PowerShellCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32[]] + # Valid exit codes for the PowerShell script. + # [Default: 0]. + ${ValidExitCode}, + + [Parameter(ParameterSetName='FileCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Uploads files to VMs (Linux, Windows). + # Corresponds to Packer file provisioner. + ${FileCustomizer}, + + [Parameter(ParameterSetName='FileCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM. + ${Destination}, + + [Parameter(ParameterSetName='FileCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The URI of the file to be uploaded for customizing the VM. + # It can be a github link, SAS URI for Azure Storage, etc. + ${SourceUri}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Installs Windows Updates. + # Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update). + ${WindowsUpdateCustomizer}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # Array of filters to select updates to apply. + # Omit or specify empty array to use the default (no filter). + # Refer to above link for examples and detailed description of this field. + ${Filter}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Criteria to search updates. + # Omit or specify empty string to use the default (search all). + # Refer to above link for examples and detailed description of this field. + ${SearchCriterion}, + + [Parameter(ParameterSetName='WindowsUpdateCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Maximum number of updates to apply at a time. + # Omit or specify 0 to use the default (1000). + ${UpdateLimit}, + + [Parameter(ParameterSetName='RestartCustomizer', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Reboots a VM and waits for it to come back online (Windows). + # Corresponds to Packer windows-restart provisioner. + ${RestartCustomizer}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Command to check if restart succeeded [Default: '']. + ${RestartCheckCommand}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart'] + ${RestartCommand}, + + [Parameter(ParameterSetName='RestartCustomizer')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Restart timeout specified as a string of magnitude and unit, e.g. + # '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']. + ${RestartTimeout} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + PowerShellCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + FileCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + WindowsUpdateCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + RestartCustomizer = 'Az.ImageBuilder.custom\New-AzImageBuilderCustomizerObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Generic distribution object +.Description +Generic distribution object +.Example +PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus + +RunOutputName Type ImageId Location +------------- ---- ------- -------- +luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus +.Example +PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd + +RunOutputName Type +------------- ---- +image-vhd Vhd +.Example +PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false + +RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi + on +------------- ---- ----------------- -------------- --------------- +outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject +#> +function New-AzImageBuilderDistributorObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor])] +[CmdletBinding(DefaultParameterSetName='ManagedImageDistributor', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Collections.Hashtable] + # Tags that will be applied to the artifact once it has been created/updated by the distributor. + ${ArtifactTag}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # The name to be used for the associated RunOutput. + ${RunOutputName}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute as a Managed Disk Image. + ${ManagedImageDistributor}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource Id of the Managed Disk Image. + ${ImageId}, + + [Parameter(ParameterSetName='ManagedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Azure location for the image, should match if image already exists. + ${Location}, + + [Parameter(ParameterSetName='VhdDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute via VHD in a storage account. + ${VhdDistributor}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Distribute via Shared Image Gallery. + ${SharedImageDistributor}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Boolean] + # Flag that indicates whether created image version should be excluded from latest. + # Omit to use the default (false). + ${ExcludeFromLatest}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String[]] + # A list of regions that the image will be replicated to. + ${ReplicationRegion}, + + [Parameter(ParameterSetName='SharedImageDistributor', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource Id of the Shared Image Gallery image. + ${GalleryImageId}, + + [Parameter(ParameterSetName='SharedImageDistributor')] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType] + # Storage account type to be used to store the shared image. + # Omit to use the default (Standard_LRS). + ${StorageAccountType} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ManagedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + VhdDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + SharedImageDistributor = 'Az.ImageBuilder.custom\New-AzImageBuilderDistributorObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Describes a virtual machine image source for building, customizing and distributing. +.Description +Describes a virtual machine image source for building, customizing and distributing. +.Example +PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image' +PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid + +Type ImageId +---- ------- +ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image +.Example +PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 + +Type ImageVersionId +---- -------------- +SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 +.Example +PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' + +Type Offer Publisher Sku Version +---- ----- --------- --- ------- +PlatformImage UbuntuServer Canonical 18.04-LTS latest + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject +#> +function New-AzImageBuilderSourceObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource])] +[CmdletBinding(DefaultParameterSetName='ManagedImage', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='ManagedImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source that is a managed image in customer subscription. + ${SourceTypeManagedImage}, + + [Parameter(ParameterSetName='ManagedImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # ARM resource id of the managed image in customer subscription. + ${ImageId}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Parameter(ParameterSetName='PlatformImage', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${SourceTypePlatformImage}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Name of the purchase plan. + ${PlanName}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Product of the purchase plan. + ${PlanProduct}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Publisher of the purchase plan. + ${PlanPublisher}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Offer}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Publisher}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Sku}, + + [Parameter(ParameterSetName='PlatformImagePlanInfo')] + [Parameter(ParameterSetName='PlatformImage')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + ${Version}, + + [Parameter(ParameterSetName='SharedImageVersion', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Describes an image source that is an image version in a shared image gallery. + ${SourceTypeSharedImageVersion}, + + [Parameter(ParameterSetName='SharedImageVersion')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # ARM resource id of the image version in the shared image gallery. + ${ImageVersionId} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + ManagedImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + PlatformImagePlanInfo = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + PlatformImage = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + SharedImageVersion = 'Az.ImageBuilder.custom\New-AzImageBuilderSourceObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a virtual machine image template +.Description +Create a virtual machine image template +.Example +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +CUSTOMIZE : Specifies the properties used to describe the customization steps of the image, like Image source etc. + Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + [Name ]: Friendly Name to provide context on what this customization step does + +DISTRIBUTE : The distribution targets where the image output needs to go to. + RunOutputName : The name to be used for the associated RunOutput. + Type : Type of distribution. + [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor. + [(Any) ]: This indicates any property can be added to this object. + +SOURCE : Describes a virtual machine image source for building, customizing and distributing. + Type : Specifies the type of source image you want to start with. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate +#> +function New-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='Name', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template. + ${ImageTemplateName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + ${SubscriptionId}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]] + # The distribution targets where the image output needs to go to. + # To construct, see NOTES section for DISTRIBUTE properties and create a hash table. + ${Distribute}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource] + # Describes a virtual machine image source for building, customizing and distributing. + # To construct, see NOTES section for SOURCE properties and create a hash table. + ${Source}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities]))] + [System.String] + # The id of user assigned identity. + ${UserAssignedIdentityId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Maximum duration to wait while building the image template. + # Omit or specify 0 to use the default (4 hours). + ${BuildTimeoutInMinute}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]] + # Specifies the properties used to describe the customization steps of the image, like Image source etc. + # To construct, see NOTES section for CUSTOMIZE properties and create a hash table. + ${Customize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # End time of the last run (UTC). + ${LastRunStatusEndTime}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose information about the last run state. + ${LastRunStatusMessage}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState] + # State of the last run. + ${LastRunStatusRunState}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState] + # Sub-state of the last run. + ${LastRunStatusRunSubState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.DateTime] + # Start time of the last run (UTC). + ${LastRunStatusStartTime}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode])] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode] + # Error code of the provisioning failure. + ${ProvisioningErrorCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Verbose error message about the provisioning failure. + ${ProvisioningErrorMessage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags]))] + [System.Collections.Hashtable] + # Resource tags. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.Int32] + # Size of the OS disk in GB. + # Omit or specify 0 to use Azure's default OS disk size. + ${VMProfileOsdiskSizeInGb}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Size of the virtual machine used to build, customize and capture images. + # Omit or specify empty string to use the default (Standard_D1_v2). + ${VMProfileVmSize}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [System.String] + # Resource id of a pre-existing subnet. + ${VnetConfigSubnetId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # region HideParameter + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + # endregion HideParameter + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Name = 'Az.ImageBuilder.custom\New-AzImageBuilderTemplate'; + } + if (('Name') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..52d5fba73206 --- /dev/null +++ b/src/ImageBuilder/exports/Remove-AzImageBuilderTemplate.ps1 @@ -0,0 +1,183 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a virtual machine image template +.Description +Delete a virtual machine image template +.Example +PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder + +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder +PS C:\> Remove-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/remove-azimagebuildertemplate +#> +function Remove-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_Delete'; + DeleteViaIdentity = 'Az.ImageBuilder.private\Remove-AzImageBuilderTemplate_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..3ae5604c7174 --- /dev/null +++ b/src/ImageBuilder/exports/Start-AzImageBuilderTemplate.ps1 @@ -0,0 +1,183 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create artifacts from a existing image template +.Description +Create artifacts from a existing image template +.Example +PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg + +.Example +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Start-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/start-azimagebuildertemplate +#> +function Start-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Run', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Run', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Run', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Run')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RunViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Run = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_Run'; + RunViaIdentity = 'Az.ImageBuilder.private\Start-AzImageBuilderTemplate_RunViaIdentity'; + } + if (('Run') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..554dc8622b64 --- /dev/null +++ b/src/ImageBuilder/exports/Stop-AzImageBuilderTemplate.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Cancel the long running image build based on the image template +.Description +Cancel the long running image build based on the image template +.Example +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder + +.Example +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Stop-AzImageBuilderTemplate -InputObject $template + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/stop-azimagebuildertemplate +#> +function Stop-AzImageBuilderTemplate { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Cancel', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Cancel', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Cancel')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CancelViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Cancel = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_Cancel'; + CancelViaIdentity = 'Az.ImageBuilder.private\Stop-AzImageBuilderTemplate_CancelViaIdentity'; + } + if (('Cancel') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/exports/readme.md b/src/ImageBuilder/exports/readme.md new file mode 100644 index 000000000000..385f62508a7c --- /dev/null +++ b/src/ImageBuilder/exports/readme.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.ImageBuilder`. No other cmdlets in this repository are directly exported. What that means is the `Az.ImageBuilder` module will run [Export-ModuleMember](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.ImageBuilder.private.dll`) and from the `..\custom\Az.ImageBuilder.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [readme.md](..\internal/readme.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.ImageBuilder.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/ImageBuilder/generate-help.ps1 b/src/ImageBuilder/generate-help.ps1 new file mode 100644 index 000000000000..c7881937ae5c --- /dev/null +++ b/src/ImageBuilder/generate-help.ps1 @@ -0,0 +1,73 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImageBuilder.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImageBuilder.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImageBuilder/generate-info.json b/src/ImageBuilder/generate-info.json new file mode 100644 index 000000000000..59a7ef6599f2 --- /dev/null +++ b/src/ImageBuilder/generate-info.json @@ -0,0 +1,8 @@ +{ + "autorest_core": "3.0.6282", + "swagger_commit": "76b6bd1989a8248987219b840f525b02e07807dc", + "autorest_powershell": "2.1.384", + "node": "v10.16.3", + "autorest": "3.0.6149", + "autorest_remodeler": "2.1.27" +} diff --git a/src/ImageBuilder/generated/Module.cs b/src/ImageBuilder/generated/Module.cs new file mode 100644 index 000000000000..a4de434d602f --- /dev/null +++ b/src/ImageBuilder/generated/Module.cs @@ -0,0 +1,158 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline _pipelineWithProxy; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module()); + + /// The Name of this module + public string Name => @"Az.ImageBuilder"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.ImageBuilder"; + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + /// constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; + _handler.UseProxy = proxy != null; + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/ImageBuilder.cs b/src/ImageBuilder/generated/api/ImageBuilder.cs new file mode 100644 index 000000000000..6825fcf0821b --- /dev/null +++ b/src/ImageBuilder/generated/api/ImageBuilder.cs @@ -0,0 +1,2329 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Low-level API implementation for the ImageBuilder service. + /// + public partial class ImageBuilder + { + + /// Lists available operations for the Microsoft.VirtualMachineImages provider + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.VirtualMachineImages/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Lists available operations for the Microsoft.VirtualMachineImages provider + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.VirtualMachineImages/operations$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.VirtualMachineImages/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.VirtualMachineImages/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// Cancel the long running image build based on the image template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesCancel_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Cancel the long running image build based on the image template + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancelViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "/cancel" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesCancel_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation"); + var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) { + asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCancel_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Create or update a virtual machine image template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// Parameters supplied to the CreateImageTemplate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Create or update a virtual machine image template + /// + /// Parameters supplied to the CreateImageTemplate operation + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesCreateOrUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) { + asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// Parameters supplied to the CreateImageTemplate operation + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesCreateOrUpdate_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate body, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete a virtual machine image template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Delete a virtual machine image template + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesDelete_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation"); + var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) { + asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesDelete_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Get information about a virtual machine image template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Get the specified run output for the specified image template resource + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// The name of the run output + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput(string subscriptionId, string resourceGroupName, string imageTemplateName, string runOutputName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "/runOutputs/" + + global::System.Uri.EscapeDataString(runOutputName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesGetRunOutput_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Get the specified run output for the specified image template resource + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutputViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)/runOutputs/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + var runOutputName = _match.Groups["runOutputName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "/runOutputs/" + + runOutputName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesGetRunOutput_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// The name of the run output + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetRunOutput_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, string runOutputName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + await eventListener.AssertNotNull(nameof(runOutputName),runOutputName); + await eventListener.AssertRegEx(nameof(runOutputName),runOutputName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Get information about a virtual machine image template + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesGet_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Gets information about the VM image templates associated with the subscription. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets information about the VM image templates associated with the specified resource group. + /// + /// The name of the resource group. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup(string resourceGroupName, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Gets information about the VM image templates associated with the specified resource group. + /// + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroupViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates'"); + } + + // replace URI parameters with values from identity + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual + /// call, but you will get validation events back. + /// + /// The name of the resource group. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListByResourceGroup_Validate(string resourceGroupName, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// List all run outputs for the specified Image Template resource + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "/runOutputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesListRunOutputs_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// List all run outputs for the specified Image Template resource + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)/runOutputs$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "/runOutputs" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesListRunOutputs_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, + /// but you will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListRunOutputs_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Gets information about the VM image templates associated with the subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.VirtualMachineImages/imageTemplates" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateListResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Create artifacts from a existing image template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun(string subscriptionId, string resourceGroupName, string imageTemplateName, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "/run" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesRun_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Create artifacts from a existing image template + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRunViaIdentity(global::System.String viaIdentity, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "/run" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesRun_Call(request,onOk,onNoContent,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func onNoContent, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var _finalUri = _response.GetFirstHeader(@"azure-asyncoperation"); + var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) { + asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesRun_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + } + } + + /// Update the tags for this Virtual Machine Image Template + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// Additional parameters for Image Template update. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + global::System.Uri.EscapeDataString(imageTemplateName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Update the tags for this Virtual Machine Image Template + /// + /// Additional parameters for Image Template update. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + var apiVersion = @"2020-02-14"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.VirtualMachineImages/imageTemplates/(?[^/]+)$", global::System.Text.RegularExpressions.RegexOptions.IgnoreCase).Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + var imageTemplateName = _match.Groups["imageTemplateName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.VirtualMachineImages/imageTemplates/" + + imageTemplateName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.VirtualMachineImageTemplatesUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: azure-async-operation + var asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"azure-asyncoperation"))) { + asyncOperation = _response.GetFirstHeader(@"azure-asyncoperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiError.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription + /// Id forms part of the URI for every service call. + /// The name of the resource group. + /// The name of the image Template + /// Additional parameters for Image Template update. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task VirtualMachineImageTemplatesUpdate_Validate(string subscriptionId, string resourceGroupName, string imageTemplateName, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters body, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(imageTemplateName),imageTemplateName); + await eventListener.AssertRegEx(nameof(imageTemplateName),imageTemplateName,@"^[A-Za-z0-9-_.]{1,64}$"); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs new file mode 100644 index 000000000000..2c03070b72a4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Api error. + [System.ComponentModel.TypeConverter(typeof(ApiErrorTypeConverter))] + public partial class ApiError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBaseTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType = (string) content.GetValueForProperty("InnerErrorExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail = (string) content.GetValueForProperty("InnerErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError) content.GetValueForProperty("InnerError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBaseTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType = (string) content.GetValueForProperty("InnerErrorExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorExceptionType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail = (string) content.GetValueForProperty("InnerErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal)this).InnerErrorDetail, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Api error. + [System.ComponentModel.TypeConverter(typeof(ApiErrorTypeConverter))] + public partial interface IApiError + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs new file mode 100644 index 000000000000..f2da89e2c9c2 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs new file mode 100644 index 000000000000..08674901fd5c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Api error. + public partial class ApiError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal + { + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] _detail; + + /// The Api error details + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get => this._detail; set => this._detail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError _innerError; + + /// The Api inner error + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError()); set => this._innerError = value; } + + /// The internal error message or exception dump. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string InnerErrorDetail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ErrorDetail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ErrorDetail = value; } + + /// The exception type. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string InnerErrorExceptionType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ExceptionType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)InnerError).ExceptionType = value; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Internal Acessors for InnerError + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorInternal.InnerError { get => (this._innerError = this._innerError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError()); set { {_innerError = value;} } } + + /// Backing field for property. + private string _target; + + /// The target of the particular error. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public ApiError() + { + + } + } + /// Api error. + public partial interface IApiError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The Api error details + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Api error details", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get; set; } + /// The internal error message or exception dump. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The internal error message or exception dump.", + SerializedName = @"errorDetail", + PossibleTypes = new [] { typeof(string) })] + string InnerErrorDetail { get; set; } + /// The exception type. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The exception type.", + SerializedName = @"exceptionType", + PossibleTypes = new [] { typeof(string) })] + string InnerErrorExceptionType { get; set; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The target of the particular error. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target of the particular error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Api error. + public partial interface IApiErrorInternal + + { + /// The error code. + string Code { get; set; } + /// The Api error details + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase[] Detail { get; set; } + /// The Api inner error + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError InnerError { get; set; } + /// The internal error message or exception dump. + string InnerErrorDetail { get; set; } + /// The exception type. + string InnerErrorExceptionType { get; set; } + /// The error message. + string Message { get; set; } + /// The target of the particular error. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs new file mode 100644 index 000000000000..d48279ddfe5b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiError.json.cs @@ -0,0 +1,117 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Api error. + public partial class ApiError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ApiError(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_innerError = If( json?.PropertyT("innerError"), out var __jsonInnerError) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.InnerError.FromJson(__jsonInnerError) : InnerError;} + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ApiErrorBase.FromJson(__u) )) ))() : null : Detail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiError FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ApiError(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._innerError ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._innerError.ToJson(null,serializationMode) : null, "innerError" ,container.Add ); + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs new file mode 100644 index 000000000000..cc27fb9e3bba --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Api error base. + [System.ComponentModel.TypeConverter(typeof(ApiErrorBaseTypeConverter))] + public partial class ApiErrorBase + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiErrorBase(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiErrorBase(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal)this).Target, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiErrorBase(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiErrorBase(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Api error base. + [System.ComponentModel.TypeConverter(typeof(ApiErrorBaseTypeConverter))] + public partial interface IApiErrorBase + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs new file mode 100644 index 000000000000..ca78771aead4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiErrorBaseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiErrorBase.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiErrorBase.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiErrorBase.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs new file mode 100644 index 000000000000..695387696c46 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.cs @@ -0,0 +1,80 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Api error base. + public partial class ApiErrorBase : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBaseInternal + { + + /// Backing field for property. + private string _code; + + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _target; + + /// The target of the particular error. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public ApiErrorBase() + { + + } + } + /// Api error base. + public partial interface IApiErrorBase : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// The error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// The target of the particular error. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The target of the particular error.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Api error base. + public partial interface IApiErrorBaseInternal + + { + /// The error code. + string Code { get; set; } + /// The error message. + string Message { get; set; } + /// The target of the particular error. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs new file mode 100644 index 000000000000..188a81821115 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ApiErrorBase.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Api error base. + public partial class ApiErrorBase + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ApiErrorBase(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IApiErrorBase FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ApiErrorBase(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs new file mode 100644 index 000000000000..df5c01bb7f21 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.PowerShell.cs @@ -0,0 +1,134 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter))] + public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId = (string) content.GetValueForProperty("ClientId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).ClientId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId = (string) content.GetValueForProperty("PrincipalId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal)this).PrincipalId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter))] + public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs new file mode 100644 index 000000000000..5b881d67e96b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.TypeConverter.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs new file mode 100644 index 000000000000..058436167fac --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.cs @@ -0,0 +1,69 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal + { + + /// Backing field for property. + private string _clientId; + + /// The client id of user assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ClientId { get => this._clientId; } + + /// Internal Acessors for ClientId + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal.ClientId { get => this._clientId; set { {_clientId = value;} } } + + /// Internal Acessors for PrincipalId + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal.PrincipalId { get => this._principalId; set { {_principalId = value;} } } + + /// Backing field for property. + private string _principalId; + + /// The principal id of user assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string PrincipalId { get => this._principalId; } + + /// + /// Creates an new instance. + /// + public ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties() + { + + } + } + public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The client id of user assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The client id of user assigned identity.", + SerializedName = @"clientId", + PossibleTypes = new [] { typeof(string) })] + string ClientId { get; } + /// The principal id of user assigned identity. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The principal id of user assigned identity.", + SerializedName = @"principalId", + PossibleTypes = new [] { typeof(string) })] + string PrincipalId { get; } + + } + public partial interface IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalpropertiesInternal + + { + /// The client id of user assigned identity. + string ClientId { get; set; } + /// The principal id of user assigned identity. + string PrincipalId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs new file mode 100644 index 000000000000..01b29ee9631e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_clientId = If( json?.PropertyT("clientId"), out var __jsonClientId) ? (string)__jsonClientId : (string)ClientId;} + {_principalId = If( json?.PropertyT("principalId"), out var __jsonPrincipalId) ? (string)__jsonPrincipalId : (string)PrincipalId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._clientId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._clientId.ToString()) : null, "clientId" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._principalId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._principalId.ToString()) : null, "principalId" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs new file mode 100644 index 000000000000..05bce4f4bd8a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.PowerShell.cs @@ -0,0 +1,189 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateTypeConverter))] + public partial class ImageTemplate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplatePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).LastRunStatusMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).SourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VMProfileVmsize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + [System.ComponentModel.TypeConverter(typeof(ImageTemplateTypeConverter))] + public partial interface IImageTemplate + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs new file mode 100644 index 000000000000..981d6a6cfd73 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs new file mode 100644 index 000000000000..aaa95efeb7c9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.cs @@ -0,0 +1,414 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + /// + public partial class ImageTemplate : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource(); + + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public int? BuildTimeoutInMinute { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).BuildTimeoutInMinute; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).BuildTimeoutInMinute = value; } + + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Customize; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Customize = value; } + + /// The distribution targets where the image output needs to go to. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Distribute; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Distribute = value; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity _identity; + + /// The identity of the image template, if configured. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set => this._identity = value; } + + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type = value; } + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity = value; } + + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public global::System.DateTime? LastRunStatusEndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusEndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusEndTime = value; } + + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string LastRunStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusMessage = value; } + + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunState = value; } + + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunSubState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusRunSubState = value; } + + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public global::System.DateTime? LastRunStatusStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusStartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatusStartTime = value; } + + /// Resource location + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Location = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set { {_identity = value;} } } + + /// Internal Acessors for LastRunStatus + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.LastRunStatus { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatus; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).LastRunStatus = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningError + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.ProvisioningError { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningError; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningError = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Source + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.Source { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Source; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).Source = value; } + + /// Internal Acessors for VMProfile + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.VMProfile { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfile; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfile = value; } + + /// Internal Acessors for VMProfileVnetConfig + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateInternal.VMProfileVnetConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVnetConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVnetConfig = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type = value; } + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties _property; + + /// The properties of the image template + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties()); set => this._property = value; } + + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorCode = value; } + + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string ProvisioningErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorMessage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningErrorMessage = value; } + + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).ProvisioningState; } + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string SourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).SourceType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).SourceType = value; } + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Tag = value; } + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)__resource).Type; } + + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public int? VMProfileOsdiskSizeGb { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileOsdiskSizeGb; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileOsdiskSizeGb = value; } + + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string VMProfileVmsize { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVmsize; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VMProfileVmsize = value; } + + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string VnetConfigSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VnetConfigSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)Property).VnetConfigSubnetId = value; } + + /// Creates an new instance. + public ImageTemplate() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + public partial interface IImageTemplate : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource + { + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).", + SerializedName = @"buildTimeoutInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? BuildTimeoutInMinute { get; set; } + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the properties used to describe the customization steps of the image, like Image source etc", + SerializedName = @"customize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; } + /// The distribution targets where the image output needs to go to. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The distribution targets where the image output needs to go to.", + SerializedName = @"distribute", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; } + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity used for the image template. The type 'None' will remove any identities from the image template.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"End time of the last run (UTC)", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRunStatusEndTime { get; set; } + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose information about the last run state", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string LastRunStatusMessage { get; set; } + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the last run", + SerializedName = @"runState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; } + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sub-state of the last run", + SerializedName = @"runSubState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; } + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the last run (UTC)", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRunStatusStartTime { get; set; } + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code of the provisioning failure", + SerializedName = @"provisioningErrorCode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; } + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose error message about the provisioning failure", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningErrorMessage { get; set; } + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the resource", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; } + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Specifies the type of source image you want to start with.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string SourceType { get; set; } + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.", + SerializedName = @"osDiskSizeGB", + PossibleTypes = new [] { typeof(int) })] + int? VMProfileOsdiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(string) })] + string VMProfileVmsize { get; set; } + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource id of a pre-existing subnet.", + SerializedName = @"subnetId", + PossibleTypes = new [] { typeof(string) })] + string VnetConfigSubnetId { get; set; } + + } + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + public partial interface IImageTemplateInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal + { + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + int? BuildTimeoutInMinute { get; set; } + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; } + /// The distribution targets where the image output needs to go to. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; } + /// The identity of the image template, if configured. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get; set; } + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// State of 'run' that is currently executing or was last executed. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus LastRunStatus { get; set; } + /// End time of the last run (UTC) + global::System.DateTime? LastRunStatusEndTime { get; set; } + /// Verbose information about the last run state + string LastRunStatusMessage { get; set; } + /// State of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; } + /// Sub-state of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; } + /// Start time of the last run (UTC) + global::System.DateTime? LastRunStatusStartTime { get; set; } + /// The properties of the image template + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties Property { get; set; } + /// Provisioning error, if any + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError ProvisioningError { get; set; } + /// Error code of the provisioning failure + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; } + /// Verbose error message about the provisioning failure + string ProvisioningErrorMessage { get; set; } + /// Provisioning state of the resource + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; set; } + /// Specifies the properties used to describe the source image. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Source { get; set; } + /// Specifies the type of source image you want to start with. + string SourceType { get; set; } + /// Describes how virtual machine is set up to build images + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile VMProfile { get; set; } + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + int? VMProfileOsdiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + string VMProfileVmsize { get; set; } + /// + /// Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual + /// network needs to be used. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig VMProfileVnetConfig { get; set; } + /// Resource id of a pre-existing subnet. + string VnetConfigSubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs new file mode 100644 index 000000000000..a252b301eaae --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplate.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + /// + public partial class ImageTemplate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplate(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Resource(json); + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity.FromJson(__jsonIdentity) : Identity;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs new file mode 100644 index 000000000000..402312cd591e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes a unit of image customization + [System.ComponentModel.TypeConverter(typeof(ImageTemplateCustomizerTypeConverter))] + public partial class ImageTemplateCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a unit of image customization + [System.ComponentModel.TypeConverter(typeof(ImageTemplateCustomizerTypeConverter))] + public partial interface IImageTemplateCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..ddf39fcf30e7 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs new file mode 100644 index 000000000000..b0a79491cf87 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.cs @@ -0,0 +1,69 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes a unit of image customization + public partial class ImageTemplateCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + + /// Backing field for property. + private string _name; + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public ImageTemplateCustomizer() + { + + } + } + /// Describes a unit of image customization + public partial interface IImageTemplateCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly Name to provide context on what this customization step does", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The type of customization tool you want to use on the Image. For example, ""Shell"" can be shell customizer", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Describes a unit of image customization + public partial interface IImageTemplateCustomizerInternal + + { + /// Friendly Name to provide context on what this customization step does + string Name { get; set; } + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs new file mode 100644 index 000000000000..75a676bf732f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateCustomizer.json.cs @@ -0,0 +1,134 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes a unit of image customization + public partial class ImageTemplateCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("type") ) + { + case "Shell": + { + return new ImageTemplateShellCustomizer(json); + } + case "WindowsRestart": + { + return new ImageTemplateRestartCustomizer(json); + } + case "WindowsUpdate": + { + return new ImageTemplateWindowsUpdateCustomizer(json); + } + case "PowerShell": + { + return new ImageTemplatePowerShellCustomizer(json); + } + case "File": + { + return new ImageTemplateFileCustomizer(json); + } + } + return new ImageTemplateCustomizer(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs new file mode 100644 index 000000000000..17168f36034c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Generic distribution object + [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorTypeConverter))] + public partial class ImageTemplateDistributor + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateDistributor(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateDistributor(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateDistributor(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateDistributor(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Generic distribution object + [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorTypeConverter))] + public partial interface IImageTemplateDistributor + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs new file mode 100644 index 000000000000..f225d862b995 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateDistributorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateDistributor.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateDistributor.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateDistributor.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs new file mode 100644 index 000000000000..cda1b8311d06 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.cs @@ -0,0 +1,86 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Generic distribution object + public partial class ImageTemplateDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags _artifactTag; + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get => (this._artifactTag = this._artifactTag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags()); set => this._artifactTag = value; } + + /// Backing field for property. + private string _runOutputName; + + /// The name to be used for the associated RunOutput. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string RunOutputName { get => this._runOutputName; set => this._runOutputName = value; } + + /// Backing field for property. + private string _type; + + /// Type of distribution. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public ImageTemplateDistributor() + { + + } + } + /// Generic distribution object + public partial interface IImageTemplateDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags that will be applied to the artifact once it has been created/updated by the distributor.", + SerializedName = @"artifactTags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get; set; } + /// The name to be used for the associated RunOutput. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name to be used for the associated RunOutput.", + SerializedName = @"runOutputName", + PossibleTypes = new [] { typeof(string) })] + string RunOutputName { get; set; } + /// Type of distribution. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Type of distribution.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Generic distribution object + public partial interface IImageTemplateDistributorInternal + + { + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get; set; } + /// The name to be used for the associated RunOutput. + string RunOutputName { get; set; } + /// Type of distribution. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs new file mode 100644 index 000000000000..695182446f26 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributor.json.cs @@ -0,0 +1,128 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Generic distribution object + public partial class ImageTemplateDistributor + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("type") ) + { + case "ManagedImage": + { + return new ImageTemplateManagedImageDistributor(json); + } + case "SharedImage": + { + return new ImageTemplateSharedImageDistributor(json); + } + case "VHD": + { + return new ImageTemplateVhdDistributor(json); + } + } + return new ImageTemplateDistributor(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateDistributor(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_artifactTag = If( json?.PropertyT("artifactTags"), out var __jsonArtifactTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags.FromJson(__jsonArtifactTags) : ArtifactTag;} + {_runOutputName = If( json?.PropertyT("runOutputName"), out var __jsonRunOutputName) ? (string)__jsonRunOutputName : (string)RunOutputName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != this._artifactTag ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._artifactTag.ToJson(null,serializationMode) : null, "artifactTags" ,container.Add ); + AddIf( null != (((object)this._runOutputName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._runOutputName.ToString()) : null, "runOutputName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs new file mode 100644 index 000000000000..89c0b635764b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorArtifactTagsTypeConverter))] + public partial class ImageTemplateDistributorArtifactTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateDistributorArtifactTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateDistributorArtifactTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateDistributorArtifactTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateDistributorArtifactTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateDistributorArtifactTagsTypeConverter))] + public partial interface IImageTemplateDistributorArtifactTags + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs new file mode 100644 index 000000000000..e6c7925deca1 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.TypeConverter.cs @@ -0,0 +1,144 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateDistributorArtifactTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateDistributorArtifactTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateDistributorArtifactTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateDistributorArtifactTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs new file mode 100644 index 000000000000..9dfc8726c222 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + public partial class ImageTemplateDistributorArtifactTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTagsInternal + { + + /// Creates an new instance. + public ImageTemplateDistributorArtifactTags() + { + + } + } + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + public partial interface IImageTemplateDistributorArtifactTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + + } + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + public partial interface IImageTemplateDistributorArtifactTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs new file mode 100644 index 000000000000..10c838d2157d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ImageTemplateDistributorArtifactTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.json.cs new file mode 100644 index 000000000000..01d34cf60e19 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateDistributorArtifactTags.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + public partial class ImageTemplateDistributorArtifactTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateDistributorArtifactTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ImageTemplateDistributorArtifactTags(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.PowerShell.cs new file mode 100644 index 000000000000..b3307e594712 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + [System.ComponentModel.TypeConverter(typeof(ImageTemplateFileCustomizerTypeConverter))] + public partial class ImageTemplateFileCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateFileCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateFileCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateFileCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Destination, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).SourceUri = (string) content.GetValueForProperty("SourceUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).SourceUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateFileCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Destination = (string) content.GetValueForProperty("Destination",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Destination, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).SourceUri = (string) content.GetValueForProperty("SourceUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal)this).SourceUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + [System.ComponentModel.TypeConverter(typeof(ImageTemplateFileCustomizerTypeConverter))] + public partial interface IImageTemplateFileCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..fdafb0ba1d19 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateFileCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateFileCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateFileCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateFileCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.cs new file mode 100644 index 000000000000..5c24bfe3dab2 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.cs @@ -0,0 +1,124 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + public partial class ImageTemplateFileCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizerInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(); + + /// Backing field for property. + private string _destination; + + /// + /// The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be + /// uploaded to in the VM + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Destination { get => this._destination; set => this._destination = value; } + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name = value; } + + /// Backing field for property. + private string _sha256Checksum; + + /// SHA256 checksum of the file provided in the sourceUri field above + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Sha256Checksum { get => this._sha256Checksum; set => this._sha256Checksum = value; } + + /// Backing field for property. + private string _sourceUri; + + /// + /// The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string SourceUri { get => this._sourceUri; set => this._sourceUri = value; } + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type = value; } + + /// Creates an new instance. + public ImageTemplateFileCustomizer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + } + } + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + public partial interface IImageTemplateFileCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + { + /// + /// The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be + /// uploaded to in the VM + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM", + SerializedName = @"destination", + PossibleTypes = new [] { typeof(string) })] + string Destination { get; set; } + /// SHA256 checksum of the file provided in the sourceUri field above + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"SHA256 checksum of the file provided in the sourceUri field above", + SerializedName = @"sha256Checksum", + PossibleTypes = new [] { typeof(string) })] + string Sha256Checksum { get; set; } + /// + /// The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc", + SerializedName = @"sourceUri", + PossibleTypes = new [] { typeof(string) })] + string SourceUri { get; set; } + + } + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + public partial interface IImageTemplateFileCustomizerInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + /// + /// The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be + /// uploaded to in the VM + /// + string Destination { get; set; } + /// SHA256 checksum of the file provided in the sourceUri field above + string Sha256Checksum { get; set; } + /// + /// The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + /// + string SourceUri { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.json.cs new file mode 100644 index 000000000000..02174de0e75f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateFileCustomizer.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner + public partial class ImageTemplateFileCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateFileCustomizer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateFileCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(json); + {_destination = If( json?.PropertyT("destination"), out var __jsonDestination) ? (string)__jsonDestination : (string)Destination;} + {_sha256Checksum = If( json?.PropertyT("sha256Checksum"), out var __jsonSha256Checksum) ? (string)__jsonSha256Checksum : (string)Sha256Checksum;} + {_sourceUri = If( json?.PropertyT("sourceUri"), out var __jsonSourceUri) ? (string)__jsonSourceUri : (string)SourceUri;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateCustomizer?.ToJson(container, serializationMode); + AddIf( null != (((object)this._destination)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._destination.ToString()) : null, "destination" ,container.Add ); + AddIf( null != (((object)this._sha256Checksum)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._sha256Checksum.ToString()) : null, "sha256Checksum" ,container.Add ); + AddIf( null != (((object)this._sourceUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._sourceUri.ToString()) : null, "sourceUri" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.PowerShell.cs new file mode 100644 index 000000000000..5e2fca07ca7a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Identity for the image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateIdentityTypeConverter))] + public partial class ImageTemplateIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).UserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("UserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).UserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).Type = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).Type, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).UserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("UserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)this).UserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Identity for the image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateIdentityTypeConverter))] + public partial interface IImageTemplateIdentity + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.TypeConverter.cs new file mode 100644 index 000000000000..eceb155abc4b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.cs new file mode 100644 index 000000000000..e803f2e80ac5 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.cs @@ -0,0 +1,78 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Identity for the image template. + public partial class ImageTemplateIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? _type; + + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? Type { get => this._type; set => this._type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities _userAssignedIdentity; + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities UserAssignedIdentity { get => (this._userAssignedIdentity = this._userAssignedIdentity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentities()); set => this._userAssignedIdentity = value; } + + /// Creates an new instance. + public ImageTemplateIdentity() + { + + } + } + /// Identity for the image template. + public partial interface IImageTemplateIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity used for the image template. The type 'None' will remove any identities from the image template.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? Type { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities UserAssignedIdentity { get; set; } + + } + /// Identity for the image template. + public partial interface IImageTemplateIdentityInternal + + { + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? Type { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities UserAssignedIdentity { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.json.cs new file mode 100644 index 000000000000..1e87e9d531e4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentity.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Identity for the image template. + public partial class ImageTemplateIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateIdentity(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_userAssignedIdentity = If( json?.PropertyT("userAssignedIdentities"), out var __jsonUserAssignedIdentities) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentities.FromJson(__jsonUserAssignedIdentities) : UserAssignedIdentity;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != this._userAssignedIdentity ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._userAssignedIdentity.ToJson(null,serializationMode) : null, "userAssignedIdentities" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.PowerShell.cs new file mode 100644 index 000000000000..3aef3e3495de --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.PowerShell.cs @@ -0,0 +1,140 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateIdentityUserAssignedIdentitiesTypeConverter))] + public partial class ImageTemplateIdentityUserAssignedIdentities + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateIdentityUserAssignedIdentities(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateIdentityUserAssignedIdentities(content); + } + + /// + /// Creates a new instance of , deserializing the content from a + /// json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateIdentityUserAssignedIdentities(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateIdentityUserAssignedIdentities(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateIdentityUserAssignedIdentitiesTypeConverter))] + public partial interface IImageTemplateIdentityUserAssignedIdentities + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.TypeConverter.cs new file mode 100644 index 000000000000..9030621ff584 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.TypeConverter.cs @@ -0,0 +1,145 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateIdentityUserAssignedIdentitiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateIdentityUserAssignedIdentities.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateIdentityUserAssignedIdentities.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateIdentityUserAssignedIdentities.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.cs new file mode 100644 index 000000000000..2b629b0fad4f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.cs @@ -0,0 +1,37 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + public partial class ImageTemplateIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentitiesInternal + { + + /// + /// Creates an new instance. + /// + public ImageTemplateIdentityUserAssignedIdentities() + { + + } + } + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public partial interface IImageTemplateIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + + } + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + public partial interface IImageTemplateIdentityUserAssignedIdentitiesInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.dictionary.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.dictionary.cs new file mode 100644 index 000000000000..2ff3d279c2e9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ImageTemplateIdentityUserAssignedIdentities : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IComponentsVrq145SchemasImagetemplateidentityPropertiesUserassignedidentitiesAdditionalproperties value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentities source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.json.cs new file mode 100644 index 000000000000..262053cd13eb --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateIdentityUserAssignedIdentities.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + public partial class ImageTemplateIdentityUserAssignedIdentities + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateIdentityUserAssignedIdentities(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ImageTemplateIdentityUserAssignedIdentities(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.PowerShell.cs new file mode 100644 index 000000000000..9440b2caabb8 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes the latest status of running an image template + [System.ComponentModel.TypeConverter(typeof(ImageTemplateLastRunStatusTypeConverter))] + public partial class ImageTemplateLastRunStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateLastRunStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateLastRunStatus(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateLastRunStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("RunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("RunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateLastRunStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("RunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("RunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).RunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the latest status of running an image template + [System.ComponentModel.TypeConverter(typeof(ImageTemplateLastRunStatusTypeConverter))] + public partial interface IImageTemplateLastRunStatus + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.TypeConverter.cs new file mode 100644 index 000000000000..9828e4607046 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateLastRunStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateLastRunStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateLastRunStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateLastRunStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.cs new file mode 100644 index 000000000000..6f9db9dd91c9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the latest status of running an image template + public partial class ImageTemplateLastRunStatus : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal + { + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _message; + + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? _runState; + + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? RunState { get => this._runState; set => this._runState = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? _runSubState; + + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? RunSubState { get => this._runSubState; set => this._runSubState = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public ImageTemplateLastRunStatus() + { + + } + } + /// Describes the latest status of running an image template + public partial interface IImageTemplateLastRunStatus : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"End time of the last run (UTC)", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose information about the last run state", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the last run", + SerializedName = @"runState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? RunState { get; set; } + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sub-state of the last run", + SerializedName = @"runSubState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? RunSubState { get; set; } + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the last run (UTC)", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + + } + /// Describes the latest status of running an image template + public partial interface IImageTemplateLastRunStatusInternal + + { + /// End time of the last run (UTC) + global::System.DateTime? EndTime { get; set; } + /// Verbose information about the last run state + string Message { get; set; } + /// State of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? RunState { get; set; } + /// Sub-state of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? RunSubState { get; set; } + /// Start time of the last run (UTC) + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.json.cs new file mode 100644 index 000000000000..46fce7b1fe8a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateLastRunStatus.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the latest status of running an image template + public partial class ImageTemplateLastRunStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateLastRunStatus(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateLastRunStatus(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_runState = If( json?.PropertyT("runState"), out var __jsonRunState) ? (string)__jsonRunState : (string)RunState;} + {_runSubState = If( json?.PropertyT("runSubState"), out var __jsonRunSubState) ? (string)__jsonRunSubState : (string)RunSubState;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._runState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._runState.ToString()) : null, "runState" ,container.Add ); + AddIf( null != (((object)this._runSubState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._runSubState.ToString()) : null, "runSubState" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.PowerShell.cs new file mode 100644 index 000000000000..886ec2338e7f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The result of List image templates operation + [System.ComponentModel.TypeConverter(typeof(ImageTemplateListResultTypeConverter))] + public partial class ImageTemplateListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The result of List image templates operation + [System.ComponentModel.TypeConverter(typeof(ImageTemplateListResultTypeConverter))] + public partial interface IImageTemplateListResult + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.TypeConverter.cs new file mode 100644 index 000000000000..d9ad4a9775f7 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.cs new file mode 100644 index 000000000000..c5e3122fb02f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The result of List image templates operation + public partial class ImageTemplateListResult : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The continuation token. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[] _value; + + /// An array of image templates + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ImageTemplateListResult() + { + + } + } + /// The result of List image templates operation + public partial interface IImageTemplateListResult : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The continuation token. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The continuation token.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// An array of image templates + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of image templates", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[] Value { get; set; } + + } + /// The result of List image templates operation + public partial interface IImageTemplateListResultInternal + + { + /// The continuation token. + string NextLink { get; set; } + /// An array of image templates + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.json.cs new file mode 100644 index 000000000000..cedfeacaf7eb --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateListResult.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The result of List image templates operation + public partial class ImageTemplateListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateListResult(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplate.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.PowerShell.cs new file mode 100644 index 000000000000..98bd6fbcc1d6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Distribute as a Managed Disk Image. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateManagedImageDistributorTypeConverter))] + public partial class ImageTemplateManagedImageDistributor + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateManagedImageDistributor(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateManagedImageDistributor(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateManagedImageDistributor(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).ImageId = (string) content.GetValueForProperty("ImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).ImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateManagedImageDistributor(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).ImageId = (string) content.GetValueForProperty("ImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).ImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Distribute as a Managed Disk Image. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateManagedImageDistributorTypeConverter))] + public partial interface IImageTemplateManagedImageDistributor + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.TypeConverter.cs new file mode 100644 index 000000000000..fea42ff3d26f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.TypeConverter.cs @@ -0,0 +1,144 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateManagedImageDistributorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateManagedImageDistributor.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateManagedImageDistributor.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateManagedImageDistributor.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.cs new file mode 100644 index 000000000000..50e59e9a6dda --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.cs @@ -0,0 +1,96 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute as a Managed Disk Image. + public partial class ImageTemplateManagedImageDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributorInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(); + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag = value; } + + /// Backing field for property. + private string _imageId; + + /// Resource Id of the Managed Disk Image + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ImageId { get => this._imageId; set => this._imageId = value; } + + /// Backing field for property. + private string _location; + + /// Azure location for the image, should match if image already exists + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// The name to be used for the associated RunOutput. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string RunOutputName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName = value; } + + /// Type of distribution. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type = value; } + + /// Creates an new instance. + public ImageTemplateManagedImageDistributor() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + } + } + /// Distribute as a Managed Disk Image. + public partial interface IImageTemplateManagedImageDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor + { + /// Resource Id of the Managed Disk Image + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resource Id of the Managed Disk Image", + SerializedName = @"imageId", + PossibleTypes = new [] { typeof(string) })] + string ImageId { get; set; } + /// Azure location for the image, should match if image already exists + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Azure location for the image, should match if image already exists", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + + } + /// Distribute as a Managed Disk Image. + public partial interface IImageTemplateManagedImageDistributorInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal + { + /// Resource Id of the Managed Disk Image + string ImageId { get; set; } + /// Azure location for the image, should match if image already exists + string Location { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.json.cs new file mode 100644 index 000000000000..34a184545987 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageDistributor.json.cs @@ -0,0 +1,106 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute as a Managed Disk Image. + public partial class ImageTemplateManagedImageDistributor + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateManagedImageDistributor(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateManagedImageDistributor(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(json); + {_imageId = If( json?.PropertyT("imageId"), out var __jsonImageId) ? (string)__jsonImageId : (string)ImageId;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateDistributor?.ToJson(container, serializationMode); + AddIf( null != (((object)this._imageId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._imageId.ToString()) : null, "imageId" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.PowerShell.cs new file mode 100644 index 000000000000..c3f1b0bb4027 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes an image source that is a managed image in customer subscription. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateManagedImageSourceTypeConverter))] + public partial class ImageTemplateManagedImageSource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateManagedImageSource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateManagedImageSource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateManagedImageSource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSourceInternal)this).ImageId = (string) content.GetValueForProperty("ImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSourceInternal)this).ImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateManagedImageSource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSourceInternal)this).ImageId = (string) content.GetValueForProperty("ImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSourceInternal)this).ImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes an image source that is a managed image in customer subscription. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateManagedImageSourceTypeConverter))] + public partial interface IImageTemplateManagedImageSource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.TypeConverter.cs new file mode 100644 index 000000000000..88a90633153f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateManagedImageSourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateManagedImageSource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateManagedImageSource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateManagedImageSource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.cs new file mode 100644 index 000000000000..07beff2fe49d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.cs @@ -0,0 +1,69 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes an image source that is a managed image in customer subscription. + public partial class ImageTemplateManagedImageSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(); + + /// Backing field for property. + private string _imageId; + + /// ARM resource id of the managed image in customer subscription + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ImageId { get => this._imageId; set => this._imageId = value; } + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type = value; } + + /// Creates an new instance. + public ImageTemplateManagedImageSource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateSource), __imageTemplateSource); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateSource), __imageTemplateSource); + } + } + /// Describes an image source that is a managed image in customer subscription. + public partial interface IImageTemplateManagedImageSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource + { + /// ARM resource id of the managed image in customer subscription + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ARM resource id of the managed image in customer subscription", + SerializedName = @"imageId", + PossibleTypes = new [] { typeof(string) })] + string ImageId { get; set; } + + } + /// Describes an image source that is a managed image in customer subscription. + public partial interface IImageTemplateManagedImageSourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal + { + /// ARM resource id of the managed image in customer subscription + string ImageId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.json.cs new file mode 100644 index 000000000000..a5cae3efe64f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateManagedImageSource.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes an image source that is a managed image in customer subscription. + public partial class ImageTemplateManagedImageSource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageSource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateManagedImageSource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateManagedImageSource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(json); + {_imageId = If( json?.PropertyT("imageId"), out var __jsonImageId) ? (string)__jsonImageId : (string)ImageId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateSource?.ToJson(container, serializationMode); + AddIf( null != (((object)this._imageId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._imageId.ToString()) : null, "imageId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.PowerShell.cs new file mode 100644 index 000000000000..f03c5675225a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.PowerShell.cs @@ -0,0 +1,151 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePlatformImageSourceTypeConverter))] + public partial class ImageTemplatePlatformImageSource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplatePlatformImageSource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplatePlatformImageSource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplatePlatformImageSource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfo = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan) content.GetValueForProperty("PlanInfo",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfo, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlanTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Offer = (string) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Offer, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Publisher, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Sku = (string) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Sku, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Version, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanName = (string) content.GetValueForProperty("PlanInfoPlanName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanProduct = (string) content.GetValueForProperty("PlanInfoPlanProduct",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanProduct, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanPublisher = (string) content.GetValueForProperty("PlanInfoPlanPublisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanPublisher, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplatePlatformImageSource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfo = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan) content.GetValueForProperty("PlanInfo",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfo, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlanTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Offer = (string) content.GetValueForProperty("Offer",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Offer, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Publisher = (string) content.GetValueForProperty("Publisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Publisher, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Sku = (string) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Sku, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Version = (string) content.GetValueForProperty("Version",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).Version, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanName = (string) content.GetValueForProperty("PlanInfoPlanName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanProduct = (string) content.GetValueForProperty("PlanInfoPlanProduct",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanProduct, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanPublisher = (string) content.GetValueForProperty("PlanInfoPlanPublisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal)this).PlanInfoPlanPublisher, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePlatformImageSourceTypeConverter))] + public partial interface IImageTemplatePlatformImageSource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.TypeConverter.cs new file mode 100644 index 000000000000..2b899f3346ed --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplatePlatformImageSourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplatePlatformImageSource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplatePlatformImageSource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplatePlatformImageSource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.cs new file mode 100644 index 000000000000..69e9088f28a4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.cs @@ -0,0 +1,200 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + public partial class ImageTemplatePlatformImageSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(); + + /// Internal Acessors for PlanInfo + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSourceInternal.PlanInfo { get => (this._planInfo = this._planInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan()); set { {_planInfo = value;} } } + + /// Backing field for property. + private string _offer; + + /// + /// Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Offer { get => this._offer; set => this._offer = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan _planInfo; + + /// Optional configuration of purchase plan for platform image. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan PlanInfo { get => (this._planInfo = this._planInfo ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan()); set => this._planInfo = value; } + + /// Name of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string PlanInfoPlanName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanName = value; } + + /// Product of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string PlanInfoPlanProduct { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanProduct; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanProduct = value; } + + /// Publisher of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string PlanInfoPlanPublisher { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanPublisher; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)PlanInfo).PlanPublisher = value; } + + /// Backing field for property. + private string _publisher; + + /// + /// Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Publisher { get => this._publisher; set => this._publisher = value; } + + /// Backing field for property. + private string _sku; + + /// + /// Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Sku { get => this._sku; set => this._sku = value; } + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type = value; } + + /// Backing field for property. + private string _version; + + /// + /// Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Version { get => this._version; set => this._version = value; } + + /// Creates an new instance. + public ImageTemplatePlatformImageSource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateSource), __imageTemplateSource); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateSource), __imageTemplateSource); + } + } + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + public partial interface IImageTemplatePlatformImageSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource + { + /// + /// Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).", + SerializedName = @"offer", + PossibleTypes = new [] { typeof(string) })] + string Offer { get; set; } + /// Name of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the purchase plan.", + SerializedName = @"planName", + PossibleTypes = new [] { typeof(string) })] + string PlanInfoPlanName { get; set; } + /// Product of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Product of the purchase plan.", + SerializedName = @"planProduct", + PossibleTypes = new [] { typeof(string) })] + string PlanInfoPlanProduct { get; set; } + /// Publisher of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Publisher of the purchase plan.", + SerializedName = @"planPublisher", + PossibleTypes = new [] { typeof(string) })] + string PlanInfoPlanPublisher { get; set; } + /// + /// Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).", + SerializedName = @"publisher", + PossibleTypes = new [] { typeof(string) })] + string Publisher { get; set; } + /// + /// Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).", + SerializedName = @"sku", + PossibleTypes = new [] { typeof(string) })] + string Sku { get; set; } + /// + /// Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages).", + SerializedName = @"version", + PossibleTypes = new [] { typeof(string) })] + string Version { get; set; } + + } + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + public partial interface IImageTemplatePlatformImageSourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal + { + /// + /// Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + string Offer { get; set; } + /// Optional configuration of purchase plan for platform image. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan PlanInfo { get; set; } + /// Name of the purchase plan. + string PlanInfoPlanName { get; set; } + /// Product of the purchase plan. + string PlanInfoPlanProduct { get; set; } + /// Publisher of the purchase plan. + string PlanInfoPlanPublisher { get; set; } + /// + /// Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + string Publisher { get; set; } + /// + /// Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + string Sku { get; set; } + /// + /// Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + string Version { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.json.cs new file mode 100644 index 000000000000..a47eb2aac52d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePlatformImageSource.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + /// + public partial class ImageTemplatePlatformImageSource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePlatformImageSource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplatePlatformImageSource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplatePlatformImageSource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(json); + {_planInfo = If( json?.PropertyT("planInfo"), out var __jsonPlanInfo) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan.FromJson(__jsonPlanInfo) : PlanInfo;} + {_offer = If( json?.PropertyT("offer"), out var __jsonOffer) ? (string)__jsonOffer : (string)Offer;} + {_publisher = If( json?.PropertyT("publisher"), out var __jsonPublisher) ? (string)__jsonPublisher : (string)Publisher;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? (string)__jsonSku : (string)Sku;} + {_version = If( json?.PropertyT("version"), out var __jsonVersion) ? (string)__jsonVersion : (string)Version;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateSource?.ToJson(container, serializationMode); + AddIf( null != this._planInfo ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._planInfo.ToJson(null,serializationMode) : null, "planInfo" ,container.Add ); + AddIf( null != (((object)this._offer)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._offer.ToString()) : null, "offer" ,container.Add ); + AddIf( null != (((object)this._publisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._publisher.ToString()) : null, "publisher" ,container.Add ); + AddIf( null != (((object)this._sku)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._sku.ToString()) : null, "sku" ,container.Add ); + AddIf( null != (((object)this._version)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._version.ToString()) : null, "version" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.PowerShell.cs new file mode 100644 index 000000000000..ad51ad42b71c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.PowerShell.cs @@ -0,0 +1,149 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePowerShellCustomizerTypeConverter))] + public partial class ImageTemplatePowerShellCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplatePowerShellCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplatePowerShellCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplatePowerShellCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Inline = (string[]) content.GetValueForProperty("Inline",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Inline, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).RunElevated = (bool?) content.GetValueForProperty("RunElevated",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).RunElevated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ScriptUri = (string) content.GetValueForProperty("ScriptUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ScriptUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ValidExitCode = (int[]) content.GetValueForProperty("ValidExitCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ValidExitCode, __y => TypeConverterExtensions.SelectToArray(__y, (__w)=> (int) global::System.Convert.ChangeType(__w, typeof(int)))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplatePowerShellCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Inline = (string[]) content.GetValueForProperty("Inline",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Inline, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).RunElevated = (bool?) content.GetValueForProperty("RunElevated",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).RunElevated, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ScriptUri = (string) content.GetValueForProperty("ScriptUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ScriptUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ValidExitCode = (int[]) content.GetValueForProperty("ValidExitCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal)this).ValidExitCode, __y => TypeConverterExtensions.SelectToArray(__y, (__w)=> (int) global::System.Convert.ChangeType(__w, typeof(int)))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePowerShellCustomizerTypeConverter))] + public partial interface IImageTemplatePowerShellCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..c5c619aaea20 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplatePowerShellCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplatePowerShellCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplatePowerShellCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplatePowerShellCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.cs new file mode 100644 index 000000000000..074bbdcfbcf7 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.cs @@ -0,0 +1,154 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + public partial class ImageTemplatePowerShellCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizerInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(); + + /// Backing field for property. + private string[] _inline; + + /// Array of PowerShell commands to execute + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string[] Inline { get => this._inline; set => this._inline = value; } + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name = value; } + + /// Backing field for property. + private bool? _runElevated; + + /// If specified, the PowerShell script will be run with elevated privileges + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public bool? RunElevated { get => this._runElevated; set => this._runElevated = value; } + + /// Backing field for property. + private string _scriptUri; + + /// + /// URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ScriptUri { get => this._scriptUri; set => this._scriptUri = value; } + + /// Backing field for property. + private string _sha256Checksum; + + /// SHA256 checksum of the power shell script provided in the scriptUri field above + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Sha256Checksum { get => this._sha256Checksum; set => this._sha256Checksum = value; } + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type = value; } + + /// Backing field for property. + private int[] _validExitCode; + + /// Valid exit codes for the PowerShell script. [Default: 0] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public int[] ValidExitCode { get => this._validExitCode; set => this._validExitCode = value; } + + /// Creates an new instance. + public ImageTemplatePowerShellCustomizer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + } + } + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + public partial interface IImageTemplatePowerShellCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + { + /// Array of PowerShell commands to execute + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Array of PowerShell commands to execute", + SerializedName = @"inline", + PossibleTypes = new [] { typeof(string) })] + string[] Inline { get; set; } + /// If specified, the PowerShell script will be run with elevated privileges + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the PowerShell script will be run with elevated privileges", + SerializedName = @"runElevated", + PossibleTypes = new [] { typeof(bool) })] + bool? RunElevated { get; set; } + /// + /// URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc", + SerializedName = @"scriptUri", + PossibleTypes = new [] { typeof(string) })] + string ScriptUri { get; set; } + /// SHA256 checksum of the power shell script provided in the scriptUri field above + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"SHA256 checksum of the power shell script provided in the scriptUri field above", + SerializedName = @"sha256Checksum", + PossibleTypes = new [] { typeof(string) })] + string Sha256Checksum { get; set; } + /// Valid exit codes for the PowerShell script. [Default: 0] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Valid exit codes for the PowerShell script. [Default: 0]", + SerializedName = @"validExitCodes", + PossibleTypes = new [] { typeof(int) })] + int[] ValidExitCode { get; set; } + + } + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + public partial interface IImageTemplatePowerShellCustomizerInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + /// Array of PowerShell commands to execute + string[] Inline { get; set; } + /// If specified, the PowerShell script will be run with elevated privileges + bool? RunElevated { get; set; } + /// + /// URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + string ScriptUri { get; set; } + /// SHA256 checksum of the power shell script provided in the scriptUri field above + string Sha256Checksum { get; set; } + /// Valid exit codes for the PowerShell script. [Default: 0] + int[] ValidExitCode { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.json.cs new file mode 100644 index 000000000000..3435d71041f9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplatePowerShellCustomizer.json.cs @@ -0,0 +1,130 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + public partial class ImageTemplatePowerShellCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplatePowerShellCustomizer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplatePowerShellCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(json); + {_inline = If( json?.PropertyT("inline"), out var __jsonInline) ? If( __jsonInline as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Inline;} + {_runElevated = If( json?.PropertyT("runElevated"), out var __jsonRunElevated) ? (bool?)__jsonRunElevated : RunElevated;} + {_scriptUri = If( json?.PropertyT("scriptUri"), out var __jsonScriptUri) ? (string)__jsonScriptUri : (string)ScriptUri;} + {_sha256Checksum = If( json?.PropertyT("sha256Checksum"), out var __jsonSha256Checksum) ? (string)__jsonSha256Checksum : (string)Sha256Checksum;} + {_validExitCode = If( json?.PropertyT("validExitCodes"), out var __jsonValidExitCodes) ? If( __jsonValidExitCodes as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(int) (__p is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNumber __o ? (int)__o : default(int))) ))() : null : ValidExitCode;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateCustomizer?.ToJson(container, serializationMode); + if (null != this._inline) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._inline ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("inline",__w); + } + AddIf( null != this._runElevated ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonBoolean((bool)this._runElevated) : null, "runElevated" ,container.Add ); + AddIf( null != (((object)this._scriptUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._scriptUri.ToString()) : null, "scriptUri" ,container.Add ); + AddIf( null != (((object)this._sha256Checksum)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._sha256Checksum.ToString()) : null, "sha256Checksum" ,container.Add ); + if (null != this._validExitCode) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __s in this._validExitCode ) + { + AddIf((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNumber(__s) ,__r.Add); + } + container.Add("validExitCodes",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.PowerShell.cs new file mode 100644 index 000000000000..4bda77abd437 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.PowerShell.cs @@ -0,0 +1,171 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes the properties of an image template + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePropertiesTypeConverter))] + public partial class ImageTemplateProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).SourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVmsize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatus = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus) content.GetValueForProperty("LastRunStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatus, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatusTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningError = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError) content.GetValueForProperty("ProvisioningError",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningError, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Source = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource) content.GetValueForProperty("Source",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Source, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSourceTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfile = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile) content.GetValueForProperty("VMProfile",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfile, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfileTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).BuildTimeoutInMinute = (int?) content.GetValueForProperty("BuildTimeoutInMinute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).BuildTimeoutInMinute, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Customize = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[]) content.GetValueForProperty("Customize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Customize, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizerTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Distribute = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[]) content.GetValueForProperty("Distribute",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).Distribute, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState?) content.GetValueForProperty("LastRunStatusRunState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorMessage = (string) content.GetValueForProperty("ProvisioningErrorMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorCode = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("ProvisioningErrorCode",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).ProvisioningErrorCode, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunSubState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState?) content.GetValueForProperty("LastRunStatusRunSubState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusRunSubState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusStartTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusStartTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusStartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusEndTime = (global::System.DateTime?) content.GetValueForProperty("LastRunStatusEndTime",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusEndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusMessage = (string) content.GetValueForProperty("LastRunStatusMessage",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).LastRunStatusMessage, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).SourceType = (string) content.GetValueForProperty("SourceType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).SourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VMProfileVnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileOsdiskSizeGb = (int?) content.GetValueForProperty("VMProfileOsdiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileOsdiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVmsize = (string) content.GetValueForProperty("VMProfileVmsize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VMProfileVmsize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of an image template + [System.ComponentModel.TypeConverter(typeof(ImageTemplatePropertiesTypeConverter))] + public partial interface IImageTemplateProperties + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.TypeConverter.cs new file mode 100644 index 000000000000..a27afde99c45 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplatePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.cs new file mode 100644 index 000000000000..a6103bd72284 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.cs @@ -0,0 +1,337 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the properties of an image template + public partial class ImageTemplateProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal + { + + /// Backing field for property. + private int? _buildTimeoutInMinute; + + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public int? BuildTimeoutInMinute { get => this._buildTimeoutInMinute; set => this._buildTimeoutInMinute = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] _customize; + + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get => this._customize; set => this._customize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] _distribute; + + /// The distribution targets where the image output needs to go to. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get => this._distribute; set => this._distribute = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus _lastRunStatus; + + /// State of 'run' that is currently executing or was last executed. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus LastRunStatus { get => (this._lastRunStatus = this._lastRunStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus()); } + + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public global::System.DateTime? LastRunStatusEndTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).EndTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).EndTime = value; } + + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string LastRunStatusMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).Message = value; } + + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).RunState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).RunState = value; } + + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).RunSubState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).RunSubState = value; } + + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public global::System.DateTime? LastRunStatusStartTime { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).StartTime; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatusInternal)LastRunStatus).StartTime = value; } + + /// Internal Acessors for LastRunStatus + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.LastRunStatus { get => (this._lastRunStatus = this._lastRunStatus ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus()); set { {_lastRunStatus = value;} } } + + /// Internal Acessors for ProvisioningError + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.ProvisioningError { get => (this._provisioningError = this._provisioningError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError()); set { {_provisioningError = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for Source + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.Source { get => (this._source = this._source ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource()); set { {_source = value;} } } + + /// Internal Acessors for VMProfile + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.VMProfile { get => (this._vMProfile = this._vMProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile()); set { {_vMProfile = value;} } } + + /// Internal Acessors for VMProfileVnetConfig + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePropertiesInternal.VMProfileVnetConfig { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VnetConfig; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VnetConfig = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError _provisioningError; + + /// Provisioning error, if any + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError ProvisioningError { get => (this._provisioningError = this._provisioningError ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError()); } + + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)ProvisioningError).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)ProvisioningError).Code = value; } + + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string ProvisioningErrorMessage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)ProvisioningError).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)ProvisioningError).Message = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? _provisioningState; + + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource _source; + + /// Specifies the properties used to describe the source image. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Source { get => (this._source = this._source ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource()); set => this._source = value; } + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string SourceType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)Source).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)Source).Type = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile _vMProfile; + + /// Describes how virtual machine is set up to build images + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile VMProfile { get => (this._vMProfile = this._vMProfile ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile()); set => this._vMProfile = value; } + + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public int? VMProfileOsdiskSizeGb { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).OSDiskSizeGb; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).OSDiskSizeGb = value; } + + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string VMProfileVmsize { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VMSize; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VMSize = value; } + + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string VnetConfigSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VnetConfigSubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)VMProfile).VnetConfigSubnetId = value; } + + /// Creates an new instance. + public ImageTemplateProperties() + { + + } + } + /// Describes the properties of an image template + public partial interface IImageTemplateProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours).", + SerializedName = @"buildTimeoutInMinutes", + PossibleTypes = new [] { typeof(int) })] + int? BuildTimeoutInMinute { get; set; } + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the properties used to describe the customization steps of the image, like Image source etc", + SerializedName = @"customize", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplatePowerShellCustomizer),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateFileCustomizer) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; } + /// The distribution targets where the image output needs to go to. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The distribution targets where the image output needs to go to.", + SerializedName = @"distribute", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateManagedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor),typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; } + /// End time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"End time of the last run (UTC)", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRunStatusEndTime { get; set; } + /// Verbose information about the last run state + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose information about the last run state", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string LastRunStatusMessage { get; set; } + /// State of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"State of the last run", + SerializedName = @"runState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; } + /// Sub-state of the last run + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sub-state of the last run", + SerializedName = @"runSubState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; } + /// Start time of the last run (UTC) + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Start time of the last run (UTC)", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? LastRunStatusStartTime { get; set; } + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code of the provisioning failure", + SerializedName = @"provisioningErrorCode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; } + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose error message about the provisioning failure", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningErrorMessage { get; set; } + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the resource", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; } + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Specifies the type of source image you want to start with.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string SourceType { get; set; } + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.", + SerializedName = @"osDiskSizeGB", + PossibleTypes = new [] { typeof(int) })] + int? VMProfileOsdiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(string) })] + string VMProfileVmsize { get; set; } + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource id of a pre-existing subnet.", + SerializedName = @"subnetId", + PossibleTypes = new [] { typeof(string) })] + string VnetConfigSubnetId { get; set; } + + } + /// Describes the properties of an image template + public partial interface IImageTemplatePropertiesInternal + + { + /// + /// Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + /// + int? BuildTimeoutInMinute { get; set; } + /// + /// Specifies the properties used to describe the customization steps of the image, like Image source etc + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] Customize { get; set; } + /// The distribution targets where the image output needs to go to. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] Distribute { get; set; } + /// State of 'run' that is currently executing or was last executed. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateLastRunStatus LastRunStatus { get; set; } + /// End time of the last run (UTC) + global::System.DateTime? LastRunStatusEndTime { get; set; } + /// Verbose information about the last run state + string LastRunStatusMessage { get; set; } + /// State of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState? LastRunStatusRunState { get; set; } + /// Sub-state of the last run + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState? LastRunStatusRunSubState { get; set; } + /// Start time of the last run (UTC) + global::System.DateTime? LastRunStatusStartTime { get; set; } + /// Provisioning error, if any + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError ProvisioningError { get; set; } + /// Error code of the provisioning failure + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? ProvisioningErrorCode { get; set; } + /// Verbose error message about the provisioning failure + string ProvisioningErrorMessage { get; set; } + /// Provisioning state of the resource + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; set; } + /// Specifies the properties used to describe the source image. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource Source { get; set; } + /// Specifies the type of source image you want to start with. + string SourceType { get; set; } + /// Describes how virtual machine is set up to build images + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile VMProfile { get; set; } + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + int? VMProfileOsdiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + string VMProfileVmsize { get; set; } + /// + /// Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual + /// network needs to be used. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig VMProfileVnetConfig { get; set; } + /// Resource id of a pre-existing subnet. + string VnetConfigSubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.json.cs new file mode 100644 index 000000000000..1c6431264689 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateProperties.json.cs @@ -0,0 +1,140 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the properties of an image template + public partial class ImageTemplateProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateProperties(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_lastRunStatus = If( json?.PropertyT("lastRunStatus"), out var __jsonLastRunStatus) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateLastRunStatus.FromJson(__jsonLastRunStatus) : LastRunStatus;} + {_provisioningError = If( json?.PropertyT("provisioningError"), out var __jsonProvisioningError) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ProvisioningError.FromJson(__jsonProvisioningError) : ProvisioningError;} + {_source = If( json?.PropertyT("source"), out var __jsonSource) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource.FromJson(__jsonSource) : Source;} + {_vMProfile = If( json?.PropertyT("vmProfile"), out var __jsonVMProfile) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateVMProfile.FromJson(__jsonVMProfile) : VMProfile;} + {_buildTimeoutInMinute = If( json?.PropertyT("buildTimeoutInMinutes"), out var __jsonBuildTimeoutInMinutes) ? (int?)__jsonBuildTimeoutInMinutes : BuildTimeoutInMinute;} + {_customize = If( json?.PropertyT("customize"), out var __jsonCustomize) ? If( __jsonCustomize as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer.FromJson(__u) )) ))() : null : Customize;} + {_distribute = If( json?.PropertyT("distribute"), out var __jsonDistribute) ? If( __jsonDistribute as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor.FromJson(__p) )) ))() : null : Distribute;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._lastRunStatus ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._lastRunStatus.ToJson(null,serializationMode) : null, "lastRunStatus" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != this._provisioningError ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._provisioningError.ToJson(null,serializationMode) : null, "provisioningError" ,container.Add ); + } + AddIf( null != this._source ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._source.ToJson(null,serializationMode) : null, "source" ,container.Add ); + AddIf( null != this._vMProfile ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._vMProfile.ToJson(null,serializationMode) : null, "vmProfile" ,container.Add ); + AddIf( null != this._buildTimeoutInMinute ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNumber((int)this._buildTimeoutInMinute) : null, "buildTimeoutInMinutes" ,container.Add ); + if (null != this._customize) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._customize ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("customize",__w); + } + if (null != this._distribute) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __s in this._distribute ) + { + AddIf(__s?.ToJson(null, serializationMode) ,__r.Add); + } + container.Add("distribute",__r); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.PowerShell.cs new file mode 100644 index 000000000000..f32d1d35e24a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateRestartCustomizerTypeConverter))] + public partial class ImageTemplateRestartCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateRestartCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateRestartCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateRestartCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCheckCommand = (string) content.GetValueForProperty("RestartCheckCommand",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCheckCommand, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCommand = (string) content.GetValueForProperty("RestartCommand",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCommand, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartTimeout = (string) content.GetValueForProperty("RestartTimeout",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartTimeout, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateRestartCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCheckCommand = (string) content.GetValueForProperty("RestartCheckCommand",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCheckCommand, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCommand = (string) content.GetValueForProperty("RestartCommand",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartCommand, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartTimeout = (string) content.GetValueForProperty("RestartTimeout",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal)this).RestartTimeout, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + [System.ComponentModel.TypeConverter(typeof(ImageTemplateRestartCustomizerTypeConverter))] + public partial interface IImageTemplateRestartCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..365088cee82c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateRestartCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateRestartCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateRestartCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateRestartCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.cs new file mode 100644 index 000000000000..4205d35f647a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + /// + public partial class ImageTemplateRestartCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizerInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(); + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name = value; } + + /// Backing field for property. + private string _restartCheckCommand; + + /// Command to check if restart succeeded [Default: ''] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string RestartCheckCommand { get => this._restartCheckCommand; set => this._restartCheckCommand = value; } + + /// Backing field for property. + private string _restartCommand; + + /// + /// Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string RestartCommand { get => this._restartCommand; set => this._restartCommand = value; } + + /// Backing field for property. + private string _restartTimeout; + + /// + /// Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string RestartTimeout { get => this._restartTimeout; set => this._restartTimeout = value; } + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type = value; } + + /// Creates an new instance. + public ImageTemplateRestartCustomizer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + } + } + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + public partial interface IImageTemplateRestartCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + { + /// Command to check if restart succeeded [Default: ''] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Command to check if restart succeeded [Default: '']", + SerializedName = @"restartCheckCommand", + PossibleTypes = new [] { typeof(string) })] + string RestartCheckCommand { get; set; } + /// + /// Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Command to execute the restart [Default: 'shutdown /r /f /t 0 /c ""packer restart""']", + SerializedName = @"restartCommand", + PossibleTypes = new [] { typeof(string) })] + string RestartCommand { get; set; } + /// + /// Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m']", + SerializedName = @"restartTimeout", + PossibleTypes = new [] { typeof(string) })] + string RestartTimeout { get; set; } + + } + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + public partial interface IImageTemplateRestartCustomizerInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + /// Command to check if restart succeeded [Default: ''] + string RestartCheckCommand { get; set; } + /// + /// Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + /// + string RestartCommand { get; set; } + /// + /// Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + /// + string RestartTimeout { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.json.cs new file mode 100644 index 000000000000..08dfc93a0545 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateRestartCustomizer.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner + /// + public partial class ImageTemplateRestartCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateRestartCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateRestartCustomizer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateRestartCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(json); + {_restartCheckCommand = If( json?.PropertyT("restartCheckCommand"), out var __jsonRestartCheckCommand) ? (string)__jsonRestartCheckCommand : (string)RestartCheckCommand;} + {_restartCommand = If( json?.PropertyT("restartCommand"), out var __jsonRestartCommand) ? (string)__jsonRestartCommand : (string)RestartCommand;} + {_restartTimeout = If( json?.PropertyT("restartTimeout"), out var __jsonRestartTimeout) ? (string)__jsonRestartTimeout : (string)RestartTimeout;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateCustomizer?.ToJson(container, serializationMode); + AddIf( null != (((object)this._restartCheckCommand)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._restartCheckCommand.ToString()) : null, "restartCheckCommand" ,container.Add ); + AddIf( null != (((object)this._restartCommand)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._restartCommand.ToString()) : null, "restartCommand" ,container.Add ); + AddIf( null != (((object)this._restartTimeout)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._restartTimeout.ToString()) : null, "restartTimeout" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.PowerShell.cs new file mode 100644 index 000000000000..b44b0152d50c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.PowerShell.cs @@ -0,0 +1,145 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Distribute via Shared Image Gallery. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSharedImageDistributorTypeConverter))] + public partial class ImageTemplateSharedImageDistributor + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateSharedImageDistributor(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateSharedImageDistributor(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateSharedImageDistributor(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ExcludeFromLatest = (bool?) content.GetValueForProperty("ExcludeFromLatest",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ExcludeFromLatest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).GalleryImageId = (string) content.GetValueForProperty("GalleryImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).GalleryImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ReplicationRegion = (string[]) content.GetValueForProperty("ReplicationRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ReplicationRegion, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).StorageAccountType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType?) content.GetValueForProperty("StorageAccountType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).StorageAccountType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateSharedImageDistributor(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ExcludeFromLatest = (bool?) content.GetValueForProperty("ExcludeFromLatest",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ExcludeFromLatest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).GalleryImageId = (string) content.GetValueForProperty("GalleryImageId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).GalleryImageId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ReplicationRegion = (string[]) content.GetValueForProperty("ReplicationRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).ReplicationRegion, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).StorageAccountType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType?) content.GetValueForProperty("StorageAccountType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal)this).StorageAccountType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Distribute via Shared Image Gallery. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSharedImageDistributorTypeConverter))] + public partial interface IImageTemplateSharedImageDistributor + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.TypeConverter.cs new file mode 100644 index 000000000000..29c04b417d22 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.TypeConverter.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateSharedImageDistributorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateSharedImageDistributor.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateSharedImageDistributor.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateSharedImageDistributor.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.cs new file mode 100644 index 000000000000..dd8557069b5e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute via Shared Image Gallery. + public partial class ImageTemplateSharedImageDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributorInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(); + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag = value; } + + /// Backing field for property. + private bool? _excludeFromLatest; + + /// + /// Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public bool? ExcludeFromLatest { get => this._excludeFromLatest; set => this._excludeFromLatest = value; } + + /// Backing field for property. + private string _galleryImageId; + + /// Resource Id of the Shared Image Gallery image + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string GalleryImageId { get => this._galleryImageId; set => this._galleryImageId = value; } + + /// Backing field for property. + private string[] _replicationRegion; + + /// A list of regions that the image will be replicated to + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string[] ReplicationRegion { get => this._replicationRegion; set => this._replicationRegion = value; } + + /// The name to be used for the associated RunOutput. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string RunOutputName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType? _storageAccountType; + + /// + /// Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType? StorageAccountType { get => this._storageAccountType; set => this._storageAccountType = value; } + + /// Type of distribution. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type = value; } + + /// Creates an new instance. + public ImageTemplateSharedImageDistributor() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + } + } + /// Distribute via Shared Image Gallery. + public partial interface IImageTemplateSharedImageDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor + { + /// + /// Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false).", + SerializedName = @"excludeFromLatest", + PossibleTypes = new [] { typeof(bool) })] + bool? ExcludeFromLatest { get; set; } + /// Resource Id of the Shared Image Gallery image + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resource Id of the Shared Image Gallery image", + SerializedName = @"galleryImageId", + PossibleTypes = new [] { typeof(string) })] + string GalleryImageId { get; set; } + /// A list of regions that the image will be replicated to + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"A list of regions that the image will be replicated to", + SerializedName = @"replicationRegions", + PossibleTypes = new [] { typeof(string) })] + string[] ReplicationRegion { get; set; } + /// + /// Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS).", + SerializedName = @"storageAccountType", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType? StorageAccountType { get; set; } + + } + /// Distribute via Shared Image Gallery. + public partial interface IImageTemplateSharedImageDistributorInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal + { + /// + /// Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + /// + bool? ExcludeFromLatest { get; set; } + /// Resource Id of the Shared Image Gallery image + string GalleryImageId { get; set; } + /// A list of regions that the image will be replicated to + string[] ReplicationRegion { get; set; } + /// + /// Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType? StorageAccountType { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.json.cs new file mode 100644 index 000000000000..0a25d82a9431 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageDistributor.json.cs @@ -0,0 +1,118 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute via Shared Image Gallery. + public partial class ImageTemplateSharedImageDistributor + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageDistributor FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateSharedImageDistributor(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateSharedImageDistributor(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(json); + {_excludeFromLatest = If( json?.PropertyT("excludeFromLatest"), out var __jsonExcludeFromLatest) ? (bool?)__jsonExcludeFromLatest : ExcludeFromLatest;} + {_galleryImageId = If( json?.PropertyT("galleryImageId"), out var __jsonGalleryImageId) ? (string)__jsonGalleryImageId : (string)GalleryImageId;} + {_replicationRegion = If( json?.PropertyT("replicationRegions"), out var __jsonReplicationRegions) ? If( __jsonReplicationRegions as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : ReplicationRegion;} + {_storageAccountType = If( json?.PropertyT("storageAccountType"), out var __jsonStorageAccountType) ? (string)__jsonStorageAccountType : (string)StorageAccountType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateDistributor?.ToJson(container, serializationMode); + AddIf( null != this._excludeFromLatest ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonBoolean((bool)this._excludeFromLatest) : null, "excludeFromLatest" ,container.Add ); + AddIf( null != (((object)this._galleryImageId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._galleryImageId.ToString()) : null, "galleryImageId" ,container.Add ); + if (null != this._replicationRegion) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._replicationRegion ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("replicationRegions",__w); + } + AddIf( null != (((object)this._storageAccountType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._storageAccountType.ToString()) : null, "storageAccountType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.PowerShell.cs new file mode 100644 index 000000000000..8caf2ff7166d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.PowerShell.cs @@ -0,0 +1,136 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes an image source that is an image version in a shared image gallery. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSharedImageVersionSourceTypeConverter))] + public partial class ImageTemplateSharedImageVersionSource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateSharedImageVersionSource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateSharedImageVersionSource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json + /// string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateSharedImageVersionSource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSourceInternal)this).ImageVersionId = (string) content.GetValueForProperty("ImageVersionId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSourceInternal)this).ImageVersionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateSharedImageVersionSource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSourceInternal)this).ImageVersionId = (string) content.GetValueForProperty("ImageVersionId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSourceInternal)this).ImageVersionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes an image source that is an image version in a shared image gallery. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSharedImageVersionSourceTypeConverter))] + public partial interface IImageTemplateSharedImageVersionSource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.TypeConverter.cs new file mode 100644 index 000000000000..3122410ffe7c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.TypeConverter.cs @@ -0,0 +1,144 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateSharedImageVersionSourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateSharedImageVersionSource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateSharedImageVersionSource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateSharedImageVersionSource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.cs new file mode 100644 index 000000000000..733c6e3327c0 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.cs @@ -0,0 +1,69 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes an image source that is an image version in a shared image gallery. + public partial class ImageTemplateSharedImageVersionSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(); + + /// Backing field for property. + private string _imageVersionId; + + /// ARM resource id of the image version in the shared image gallery + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ImageVersionId { get => this._imageVersionId; set => this._imageVersionId = value; } + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)__imageTemplateSource).Type = value; } + + /// Creates an new instance. + public ImageTemplateSharedImageVersionSource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateSource), __imageTemplateSource); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateSource), __imageTemplateSource); + } + } + /// Describes an image source that is an image version in a shared image gallery. + public partial interface IImageTemplateSharedImageVersionSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource + { + /// ARM resource id of the image version in the shared image gallery + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"ARM resource id of the image version in the shared image gallery", + SerializedName = @"imageVersionId", + PossibleTypes = new [] { typeof(string) })] + string ImageVersionId { get; set; } + + } + /// Describes an image source that is an image version in a shared image gallery. + public partial interface IImageTemplateSharedImageVersionSourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal + { + /// ARM resource id of the image version in the shared image gallery + string ImageVersionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.json.cs new file mode 100644 index 000000000000..ecad4f03f09e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSharedImageVersionSource.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes an image source that is an image version in a shared image gallery. + public partial class ImageTemplateSharedImageVersionSource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSharedImageVersionSource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateSharedImageVersionSource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateSharedImageVersionSource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateSource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateSource(json); + {_imageVersionId = If( json?.PropertyT("imageVersionId"), out var __jsonImageVersionId) ? (string)__jsonImageVersionId : (string)ImageVersionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateSource?.ToJson(container, serializationMode); + AddIf( null != (((object)this._imageVersionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._imageVersionId.ToString()) : null, "imageVersionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.PowerShell.cs new file mode 100644 index 000000000000..f3e37aa6c621 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.PowerShell.cs @@ -0,0 +1,145 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateShellCustomizerTypeConverter))] + public partial class ImageTemplateShellCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateShellCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateShellCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateShellCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Inline = (string[]) content.GetValueForProperty("Inline",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Inline, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).ScriptUri = (string) content.GetValueForProperty("ScriptUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).ScriptUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateShellCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Inline = (string[]) content.GetValueForProperty("Inline",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Inline, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).ScriptUri = (string) content.GetValueForProperty("ScriptUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).ScriptUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Sha256Checksum = (string) content.GetValueForProperty("Sha256Checksum",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal)this).Sha256Checksum, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateShellCustomizerTypeConverter))] + public partial interface IImageTemplateShellCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..c2e5c717045f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateShellCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateShellCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateShellCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateShellCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.cs new file mode 100644 index 000000000000..4373798bc378 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.cs @@ -0,0 +1,120 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + public partial class ImageTemplateShellCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizerInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(); + + /// Backing field for property. + private string[] _inline; + + /// Array of shell commands to execute + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string[] Inline { get => this._inline; set => this._inline = value; } + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name = value; } + + /// Backing field for property. + private string _scriptUri; + + /// + /// URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ScriptUri { get => this._scriptUri; set => this._scriptUri = value; } + + /// Backing field for property. + private string _sha256Checksum; + + /// SHA256 checksum of the shell script provided in the scriptUri field + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Sha256Checksum { get => this._sha256Checksum; set => this._sha256Checksum = value; } + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type = value; } + + /// Creates an new instance. + public ImageTemplateShellCustomizer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + } + } + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + public partial interface IImageTemplateShellCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + { + /// Array of shell commands to execute + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Array of shell commands to execute", + SerializedName = @"inline", + PossibleTypes = new [] { typeof(string) })] + string[] Inline { get; set; } + /// + /// URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc", + SerializedName = @"scriptUri", + PossibleTypes = new [] { typeof(string) })] + string ScriptUri { get; set; } + /// SHA256 checksum of the shell script provided in the scriptUri field + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"SHA256 checksum of the shell script provided in the scriptUri field", + SerializedName = @"sha256Checksum", + PossibleTypes = new [] { typeof(string) })] + string Sha256Checksum { get; set; } + + } + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + public partial interface IImageTemplateShellCustomizerInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + /// Array of shell commands to execute + string[] Inline { get; set; } + /// + /// URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + /// + string ScriptUri { get; set; } + /// SHA256 checksum of the shell script provided in the scriptUri field + string Sha256Checksum { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.json.cs new file mode 100644 index 000000000000..f8e95d041bf3 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateShellCustomizer.json.cs @@ -0,0 +1,118 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of 'scriptUri' + /// or 'inline' can be specified. + /// + public partial class ImageTemplateShellCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateShellCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateShellCustomizer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateShellCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(json); + {_inline = If( json?.PropertyT("inline"), out var __jsonInline) ? If( __jsonInline as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Inline;} + {_scriptUri = If( json?.PropertyT("scriptUri"), out var __jsonScriptUri) ? (string)__jsonScriptUri : (string)ScriptUri;} + {_sha256Checksum = If( json?.PropertyT("sha256Checksum"), out var __jsonSha256Checksum) ? (string)__jsonSha256Checksum : (string)Sha256Checksum;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateCustomizer?.ToJson(container, serializationMode); + if (null != this._inline) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._inline ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("inline",__w); + } + AddIf( null != (((object)this._scriptUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._scriptUri.ToString()) : null, "scriptUri" ,container.Add ); + AddIf( null != (((object)this._sha256Checksum)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._sha256Checksum.ToString()) : null, "sha256Checksum" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.PowerShell.cs new file mode 100644 index 000000000000..5ef9fc4b1da1 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Describes a virtual machine image source for building, customizing and distributing + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSourceTypeConverter))] + public partial class ImageTemplateSource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateSource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateSource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateSource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateSource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a virtual machine image source for building, customizing and distributing + [System.ComponentModel.TypeConverter(typeof(ImageTemplateSourceTypeConverter))] + public partial interface IImageTemplateSource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.TypeConverter.cs new file mode 100644 index 000000000000..70142f814f02 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateSourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateSource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateSource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateSource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.cs new file mode 100644 index 000000000000..e81d3c9194f2 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.cs @@ -0,0 +1,48 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Describes a virtual machine image source for building, customizing and distributing + /// + public partial class ImageTemplateSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSourceInternal + { + + /// Backing field for property. + private string _type; + + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public ImageTemplateSource() + { + + } + } + /// Describes a virtual machine image source for building, customizing and distributing + public partial interface IImageTemplateSource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Specifies the type of source image you want to start with. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Specifies the type of source image you want to start with.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Describes a virtual machine image source for building, customizing and distributing + public partial interface IImageTemplateSourceInternal + + { + /// Specifies the type of source image you want to start with. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.json.cs new file mode 100644 index 000000000000..b0ea13477d81 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateSource.json.cs @@ -0,0 +1,126 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Describes a virtual machine image source for building, customizing and distributing + /// + public partial class ImageTemplateSource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource. + /// Note: the Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource interface is polymorphic, + /// and the precise model class that will get deserialized is determined at runtime based on the payload. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + if (!(node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json)) + { + return null; + } + // Polymorphic type -- select the appropriate constructor using the discriminator + + switch ( json.StringProperty("type") ) + { + case "ManagedImage": + { + return new ImageTemplateManagedImageSource(json); + } + case "SharedImageVersion": + { + return new ImageTemplateSharedImageVersionSource(json); + } + case "PlatformImage": + { + return new ImageTemplatePlatformImageSource(json); + } + } + return new ImageTemplateSource(json); + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateSource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.PowerShell.cs new file mode 100644 index 000000000000..2efec5ef979c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Parameters for updating an image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateUpdateParametersTypeConverter))] + public partial class ImageTemplateUpdateParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateUpdateParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateUpdateParameters(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateUpdateParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateUpdateParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Identity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity) content.GetValueForProperty("Identity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Identity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityType = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType?) content.GetValueForProperty("IdentityType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityType, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityUserAssignedIdentity = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) content.GetValueForProperty("IdentityUserAssignedIdentity",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal)this).IdentityUserAssignedIdentity, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentityUserAssignedIdentitiesTypeConverter.ConvertFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Parameters for updating an image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateUpdateParametersTypeConverter))] + public partial interface IImageTemplateUpdateParameters + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.TypeConverter.cs new file mode 100644 index 000000000000..3c86da7a2b12 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateUpdateParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateUpdateParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateUpdateParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateUpdateParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.cs new file mode 100644 index 000000000000..c3ca336dbdf6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Parameters for updating an image template. + public partial class ImageTemplateUpdateParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity _identity; + + /// The identity of the image template, if configured. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set => this._identity = value; } + + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).Type = value; } + + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityInternal)Identity).UserAssignedIdentity = value; } + + /// Internal Acessors for Identity + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersInternal.Identity { get => (this._identity = this._identity ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity()); set { {_identity = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags _tag; + + /// The user-specified tags associated with the image template. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags()); set => this._tag = value; } + + /// Creates an new instance. + public ImageTemplateUpdateParameters() + { + + } + } + /// Parameters for updating an image template. + public partial interface IImageTemplateUpdateParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of identity used for the image template. The type 'None' will remove any identities from the image template.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.", + SerializedName = @"userAssignedIdentities", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// The user-specified tags associated with the image template. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The user-specified tags associated with the image template.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags Tag { get; set; } + + } + /// Parameters for updating an image template. + public partial interface IImageTemplateUpdateParametersInternal + + { + /// The identity of the image template, if configured. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentity Identity { get; set; } + /// + /// The type of identity used for the image template. The type 'None' will remove any identities from the image template. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType? IdentityType { get; set; } + /// + /// The list of user identities associated with the image template. The user identity dictionary key references will be ARM + /// resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateIdentityUserAssignedIdentities IdentityUserAssignedIdentity { get; set; } + /// The user-specified tags associated with the image template. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.json.cs new file mode 100644 index 000000000000..683e2bfe180a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParameters.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Parameters for updating an image template. + public partial class ImageTemplateUpdateParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateUpdateParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateUpdateParameters(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_identity = If( json?.PropertyT("identity"), out var __jsonIdentity) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateIdentity.FromJson(__jsonIdentity) : Identity;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._identity ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._identity.ToJson(null,serializationMode) : null, "identity" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.PowerShell.cs new file mode 100644 index 000000000000..27d12097b89c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The user-specified tags associated with the image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateUpdateParametersTagsTypeConverter))] + public partial class ImageTemplateUpdateParametersTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateUpdateParametersTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateUpdateParametersTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateUpdateParametersTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateUpdateParametersTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The user-specified tags associated with the image template. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateUpdateParametersTagsTypeConverter))] + public partial interface IImageTemplateUpdateParametersTags + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.TypeConverter.cs new file mode 100644 index 000000000000..1b6f035a35fa --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateUpdateParametersTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateUpdateParametersTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateUpdateParametersTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateUpdateParametersTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.cs new file mode 100644 index 000000000000..2dbdb6d677e3 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.cs @@ -0,0 +1,30 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The user-specified tags associated with the image template. + public partial class ImageTemplateUpdateParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTagsInternal + { + + /// Creates an new instance. + public ImageTemplateUpdateParametersTags() + { + + } + } + /// The user-specified tags associated with the image template. + public partial interface IImageTemplateUpdateParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + + } + /// The user-specified tags associated with the image template. + public partial interface IImageTemplateUpdateParametersTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.dictionary.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.dictionary.cs new file mode 100644 index 000000000000..2ae6270b89a4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ImageTemplateUpdateParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateUpdateParametersTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.json.cs new file mode 100644 index 000000000000..f2e26f69c079 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateUpdateParametersTags.json.cs @@ -0,0 +1,102 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The user-specified tags associated with the image template. + public partial class ImageTemplateUpdateParametersTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateUpdateParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateUpdateParametersTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ImageTemplateUpdateParametersTags(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.PowerShell.cs new file mode 100644 index 000000000000..cea5ea9f8326 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes the virtual machine used to build, customize and capture images + [System.ComponentModel.TypeConverter(typeof(ImageTemplateVMProfileTypeConverter))] + public partial class ImageTemplateVMProfile + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateVMProfile(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateVMProfile(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateVMProfile(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).OSDiskSizeGb = (int?) content.GetValueForProperty("OSDiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).OSDiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VMSize = (string) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VMSize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateVMProfile(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfig = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig) content.GetValueForProperty("VnetConfig",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfig, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfigTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).OSDiskSizeGb = (int?) content.GetValueForProperty("OSDiskSizeGb",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).OSDiskSizeGb, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VMSize = (string) content.GetValueForProperty("VMSize",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VMSize, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfigSubnetId = (string) content.GetValueForProperty("VnetConfigSubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal)this).VnetConfigSubnetId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the virtual machine used to build, customize and capture images + [System.ComponentModel.TypeConverter(typeof(ImageTemplateVMProfileTypeConverter))] + public partial interface IImageTemplateVMProfile + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.TypeConverter.cs new file mode 100644 index 000000000000..2b0b3ad42ee4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateVMProfileTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateVMProfile.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateVMProfile.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateVMProfile.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.cs new file mode 100644 index 000000000000..028ca8841da3 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.cs @@ -0,0 +1,110 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the virtual machine used to build, customize and capture images + public partial class ImageTemplateVMProfile : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal + { + + /// Internal Acessors for VnetConfig + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfileInternal.VnetConfig { get => (this._vnetConfig = this._vnetConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig()); set { {_vnetConfig = value;} } } + + /// Backing field for property. + private int? _oSDiskSizeGb; + + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public int? OSDiskSizeGb { get => this._oSDiskSizeGb; set => this._oSDiskSizeGb = value; } + + /// Backing field for property. + private string _vMSize; + + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string VMSize { get => this._vMSize; set => this._vMSize = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig _vnetConfig; + + /// + /// Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual + /// network needs to be used. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig VnetConfig { get => (this._vnetConfig = this._vnetConfig ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig()); set => this._vnetConfig = value; } + + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string VnetConfigSubnetId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)VnetConfig).SubnetId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)VnetConfig).SubnetId = value; } + + /// Creates an new instance. + public ImageTemplateVMProfile() + { + + } + } + /// Describes the virtual machine used to build, customize and capture images + public partial interface IImageTemplateVMProfile : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size.", + SerializedName = @"osDiskSizeGB", + PossibleTypes = new [] { typeof(int) })] + int? OSDiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2).", + SerializedName = @"vmSize", + PossibleTypes = new [] { typeof(string) })] + string VMSize { get; set; } + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource id of a pre-existing subnet.", + SerializedName = @"subnetId", + PossibleTypes = new [] { typeof(string) })] + string VnetConfigSubnetId { get; set; } + + } + /// Describes the virtual machine used to build, customize and capture images + public partial interface IImageTemplateVMProfileInternal + + { + /// + /// Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + /// + int? OSDiskSizeGb { get; set; } + /// + /// Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default + /// (Standard_D1_v2). + /// + string VMSize { get; set; } + /// + /// Optional configuration of the virtual network to use to deploy the build virtual machine in. Omit if no specific virtual + /// network needs to be used. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig VnetConfig { get; set; } + /// Resource id of a pre-existing subnet. + string VnetConfigSubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.json.cs new file mode 100644 index 000000000000..aa7b2095e5df --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVMProfile.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the virtual machine used to build, customize and capture images + public partial class ImageTemplateVMProfile + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVMProfile FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateVMProfile(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateVMProfile(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_vnetConfig = If( json?.PropertyT("vnetConfig"), out var __jsonVnetConfig) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.VirtualNetworkConfig.FromJson(__jsonVnetConfig) : VnetConfig;} + {_oSDiskSizeGb = If( json?.PropertyT("osDiskSizeGB"), out var __jsonOSDiskSizeGb) ? (int?)__jsonOSDiskSizeGb : OSDiskSizeGb;} + {_vMSize = If( json?.PropertyT("vmSize"), out var __jsonVMSize) ? (string)__jsonVMSize : (string)VMSize;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._vnetConfig ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._vnetConfig.ToJson(null,serializationMode) : null, "vnetConfig" ,container.Add ); + AddIf( null != this._oSDiskSizeGb ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNumber((int)this._oSDiskSizeGb) : null, "osDiskSizeGB" ,container.Add ); + AddIf( null != (((object)this._vMSize)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._vMSize.ToString()) : null, "vmSize" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.PowerShell.cs new file mode 100644 index 000000000000..b292e0a17518 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Distribute via VHD in a storage account. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateVhdDistributorTypeConverter))] + public partial class ImageTemplateVhdDistributor + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateVhdDistributor(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateVhdDistributor(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateVhdDistributor(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateVhdDistributor(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags) content.GetValueForProperty("ArtifactTag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).ArtifactTag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributorArtifactTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)this).RunOutputName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Distribute via VHD in a storage account. + [System.ComponentModel.TypeConverter(typeof(ImageTemplateVhdDistributorTypeConverter))] + public partial interface IImageTemplateVhdDistributor + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.TypeConverter.cs new file mode 100644 index 000000000000..b527b56bd01f --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateVhdDistributorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateVhdDistributor.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateVhdDistributor.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateVhdDistributor.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.cs new file mode 100644 index 000000000000..c629ddcc60b2 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.cs @@ -0,0 +1,62 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute via VHD in a storage account. + public partial class ImageTemplateVhdDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributorInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(); + + /// + /// Tags that will be applied to the artifact once it has been created/updated by the distributor. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorArtifactTags ArtifactTag { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).ArtifactTag = value; } + + /// The name to be used for the associated RunOutput. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string RunOutputName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).RunOutputName = value; } + + /// Type of distribution. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal)__imageTemplateDistributor).Type = value; } + + /// Creates an new instance. + public ImageTemplateVhdDistributor() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateDistributor), __imageTemplateDistributor); + } + } + /// Distribute via VHD in a storage account. + public partial interface IImageTemplateVhdDistributor : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor + { + + } + /// Distribute via VHD in a storage account. + public partial interface IImageTemplateVhdDistributorInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributorInternal + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.json.cs new file mode 100644 index 000000000000..8661f55131d4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateVhdDistributor.json.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Distribute via VHD in a storage account. + public partial class ImageTemplateVhdDistributor + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateVhdDistributor FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateVhdDistributor(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateVhdDistributor(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateDistributor = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateDistributor(json); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateDistributor?.ToJson(container, serializationMode); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.PowerShell.cs new file mode 100644 index 000000000000..47fe0af447b0 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + /// + [System.ComponentModel.TypeConverter(typeof(ImageTemplateWindowsUpdateCustomizerTypeConverter))] + public partial class ImageTemplateWindowsUpdateCustomizer + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageTemplateWindowsUpdateCustomizer(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageTemplateWindowsUpdateCustomizer(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageTemplateWindowsUpdateCustomizer(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).Filter = (string[]) content.GetValueForProperty("Filter",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).Filter, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).SearchCriterion = (string) content.GetValueForProperty("SearchCriterion",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).SearchCriterion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).UpdateLimit = (int?) content.GetValueForProperty("UpdateLimit",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).UpdateLimit, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageTemplateWindowsUpdateCustomizer(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).Filter = (string[]) content.GetValueForProperty("Filter",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).Filter, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).SearchCriterion = (string) content.GetValueForProperty("SearchCriterion",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).SearchCriterion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).UpdateLimit = (int?) content.GetValueForProperty("UpdateLimit",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal)this).UpdateLimit, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + [System.ComponentModel.TypeConverter(typeof(ImageTemplateWindowsUpdateCustomizerTypeConverter))] + public partial interface IImageTemplateWindowsUpdateCustomizer + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.TypeConverter.cs new file mode 100644 index 000000000000..677bee2c30cc --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.TypeConverter.cs @@ -0,0 +1,144 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageTemplateWindowsUpdateCustomizerTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageTemplateWindowsUpdateCustomizer.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageTemplateWindowsUpdateCustomizer.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageTemplateWindowsUpdateCustomizer.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.cs new file mode 100644 index 000000000000..9afcad04f2d6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + /// + public partial class ImageTemplateWindowsUpdateCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizerInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(); + + /// Backing field for property. + private string[] _filter; + + /// + /// Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above + /// link for examples and detailed description of this field. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string[] Filter { get => this._filter; set => this._filter = value; } + + /// Friendly Name to provide context on what this customization step does + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Name = value; } + + /// Backing field for property. + private string _searchCriterion; + + /// + /// Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples + /// and detailed description of this field. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string SearchCriterion { get => this._searchCriterion; set => this._searchCriterion = value; } + + /// + /// The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal)__imageTemplateCustomizer).Type = value; } + + /// Backing field for property. + private int? _updateLimit; + + /// + /// Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public int? UpdateLimit { get => this._updateLimit; set => this._updateLimit = value; } + + /// Creates an new instance. + public ImageTemplateWindowsUpdateCustomizer() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + await eventListener.AssertObjectIsValid(nameof(__imageTemplateCustomizer), __imageTemplateCustomizer); + } + } + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + public partial interface IImageTemplateWindowsUpdateCustomizer : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + { + /// + /// Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above + /// link for examples and detailed description of this field. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field.", + SerializedName = @"filters", + PossibleTypes = new [] { typeof(string) })] + string[] Filter { get; set; } + /// + /// Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples + /// and detailed description of this field. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field.", + SerializedName = @"searchCriteria", + PossibleTypes = new [] { typeof(string) })] + string SearchCriterion { get; set; } + /// + /// Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000)", + SerializedName = @"updateLimit", + PossibleTypes = new [] { typeof(int) })] + int? UpdateLimit { get; set; } + + } + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + public partial interface IImageTemplateWindowsUpdateCustomizerInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizerInternal + { + /// + /// Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above + /// link for examples and detailed description of this field. + /// + string[] Filter { get; set; } + /// + /// Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples + /// and detailed description of this field. + /// + string SearchCriterion { get; set; } + /// + /// Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + /// + int? UpdateLimit { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.json.cs new file mode 100644 index 000000000000..0b3105e9d329 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ImageTemplateWindowsUpdateCustomizer.json.cs @@ -0,0 +1,118 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Installs Windows Updates. Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update) + /// + public partial class ImageTemplateWindowsUpdateCustomizer + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateWindowsUpdateCustomizer FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageTemplateWindowsUpdateCustomizer(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageTemplateWindowsUpdateCustomizer(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __imageTemplateCustomizer = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ImageTemplateCustomizer(json); + {_filter = If( json?.PropertyT("filters"), out var __jsonFilters) ? If( __jsonFilters as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Filter;} + {_searchCriterion = If( json?.PropertyT("searchCriteria"), out var __jsonSearchCriteria) ? (string)__jsonSearchCriteria : (string)SearchCriterion;} + {_updateLimit = If( json?.PropertyT("updateLimit"), out var __jsonUpdateLimit) ? (int?)__jsonUpdateLimit : UpdateLimit;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __imageTemplateCustomizer?.ToJson(container, serializationMode); + if (null != this._filter) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._filter ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("filters",__w); + } + AddIf( null != (((object)this._searchCriterion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._searchCriterion.ToString()) : null, "searchCriteria" ,container.Add ); + AddIf( null != this._updateLimit ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNumber((int)this._updateLimit) : null, "updateLimit" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.PowerShell.cs new file mode 100644 index 000000000000..4750ee5d8d00 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Inner error details. + [System.ComponentModel.TypeConverter(typeof(InnerErrorTypeConverter))] + public partial class InnerError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new InnerError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new InnerError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal InnerError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ErrorDetail = (string) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ErrorDetail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ExceptionType = (string) content.GetValueForProperty("ExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ExceptionType, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal InnerError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ErrorDetail = (string) content.GetValueForProperty("ErrorDetail",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ErrorDetail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ExceptionType = (string) content.GetValueForProperty("ExceptionType",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal)this).ExceptionType, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Inner error details. + [System.ComponentModel.TypeConverter(typeof(InnerErrorTypeConverter))] + public partial interface IInnerError + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.TypeConverter.cs new file mode 100644 index 000000000000..8c4fc3ac7c63 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class InnerErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return InnerError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return InnerError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return InnerError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.cs b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.cs new file mode 100644 index 000000000000..15763f9464a4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Inner error details. + public partial class InnerError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerErrorInternal + { + + /// Backing field for property. + private string _errorDetail; + + /// The internal error message or exception dump. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ErrorDetail { get => this._errorDetail; set => this._errorDetail = value; } + + /// Backing field for property. + private string _exceptionType; + + /// The exception type. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ExceptionType { get => this._exceptionType; set => this._exceptionType = value; } + + /// Creates an new instance. + public InnerError() + { + + } + } + /// Inner error details. + public partial interface IInnerError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The internal error message or exception dump. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The internal error message or exception dump.", + SerializedName = @"errorDetail", + PossibleTypes = new [] { typeof(string) })] + string ErrorDetail { get; set; } + /// The exception type. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The exception type.", + SerializedName = @"exceptionType", + PossibleTypes = new [] { typeof(string) })] + string ExceptionType { get; set; } + + } + /// Inner error details. + public partial interface IInnerErrorInternal + + { + /// The internal error message or exception dump. + string ErrorDetail { get; set; } + /// The exception type. + string ExceptionType { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.json.cs new file mode 100644 index 000000000000..8c26e22c595a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/InnerError.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Inner error details. + public partial class InnerError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IInnerError FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new InnerError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal InnerError(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_errorDetail = If( json?.PropertyT("errorDetail"), out var __jsonErrorDetail) ? (string)__jsonErrorDetail : (string)ErrorDetail;} + {_exceptionType = If( json?.PropertyT("exceptionType"), out var __jsonExceptionType) ? (string)__jsonExceptionType : (string)ExceptionType;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._errorDetail)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._errorDetail.ToString()) : null, "errorDetail" ,container.Add ); + AddIf( null != (((object)this._exceptionType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._exceptionType.ToString()) : null, "exceptionType" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Operation.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.PowerShell.cs new file mode 100644 index 000000000000..a8d377218e3a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.PowerShell.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// A REST API operation + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial class Operation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Operation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Operation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Operation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Operation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A REST API operation + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial interface IOperation + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Operation.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.TypeConverter.cs new file mode 100644 index 000000000000..bf3f78080eab --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Operation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Operation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Operation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Operation.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.cs new file mode 100644 index 000000000000..0e751ba6b5de --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.cs @@ -0,0 +1,165 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// A REST API operation + public partial class Operation : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay _display; + + /// The object that describes the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay()); set => this._display = value; } + + /// The friendly name of the operation + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Description = value; } + + /// For example: read, write, delete, or listKeys/action + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Operation = value; } + + /// Friendly name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Provider = value; } + + /// The resource type on which the operation is performed. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)Display).Resource = value; } + + /// Backing field for property. + private bool? _isDataAction; + + /// The flag that indicates whether the operation applies to data plane. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay()); set { {_display = value;} } } + + /// Backing field for property. + private string _name; + + /// This is of the format {provider}/{resource}/{operation} + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _origin; + + /// The intended executor of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Origin { get => this._origin; set => this._origin = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties _property; + + /// Properties of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationProperties()); set => this._property = value; } + + /// Creates an new instance. + public Operation() + { + + } + } + /// A REST API operation + public partial interface IOperation : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The friendly name of the operation + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the operation", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// For example: read, write, delete, or listKeys/action + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"For example: read, write, delete, or listKeys/action", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// Friendly name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the resource provider.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// The resource type on which the operation is performed. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource type on which the operation is performed.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// The flag that indicates whether the operation applies to data plane. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The flag that indicates whether the operation applies to data plane.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; set; } + /// This is of the format {provider}/{resource}/{operation} + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"This is of the format {provider}/{resource}/{operation}", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The intended executor of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The intended executor of the operation.", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; set; } + /// Properties of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Properties of the operation.", + SerializedName = @"properties", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties Property { get; set; } + + } + /// A REST API operation + public partial interface IOperationInternal + + { + /// The object that describes the operation. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay Display { get; set; } + /// The friendly name of the operation + string DisplayDescription { get; set; } + /// For example: read, write, delete, or listKeys/action + string DisplayOperation { get; set; } + /// Friendly name of the resource provider. + string DisplayProvider { get; set; } + /// The resource type on which the operation is performed. + string DisplayResource { get; set; } + /// The flag that indicates whether the operation applies to data plane. + bool? IsDataAction { get; set; } + /// This is of the format {provider}/{resource}/{operation} + string Name { get; set; } + /// The intended executor of the operation. + string Origin { get; set; } + /// Properties of the operation. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Operation.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.json.cs new file mode 100644 index 000000000000..42d8191a5605 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Operation.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// A REST API operation + public partial class Operation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new Operation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal Operation(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationDisplay.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.PowerShell.cs new file mode 100644 index 000000000000..a5309bc96825 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The object that describes the operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial class OperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The object that describes the operation. + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial interface IOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.TypeConverter.cs new file mode 100644 index 000000000000..cc95e259a3c7 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.cs new file mode 100644 index 000000000000..11fea4df85b3 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.cs @@ -0,0 +1,97 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The object that describes the operation. + public partial class OperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// The friendly name of the operation + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// For example: read, write, delete, or listKeys/action + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// Friendly name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// The resource type on which the operation is performed. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public OperationDisplay() + { + + } + } + /// The object that describes the operation. + public partial interface IOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The friendly name of the operation + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The friendly name of the operation", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// For example: read, write, delete, or listKeys/action + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"For example: read, write, delete, or listKeys/action", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// Friendly name of the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Friendly name of the resource provider.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// The resource type on which the operation is performed. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource type on which the operation is performed.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// The object that describes the operation. + public partial interface IOperationDisplayInternal + + { + /// The friendly name of the operation + string Description { get; set; } + /// For example: read, write, delete, or listKeys/action + string Operation { get; set; } + /// Friendly name of the resource provider. + string Provider { get; set; } + /// The resource type on which the operation is performed. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.json.cs new file mode 100644 index 000000000000..3dcf8a46593d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationDisplay.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The object that describes the operation. + public partial class OperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.PowerShell.cs new file mode 100644 index 000000000000..9c38cd01207b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + /// + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial class OperationListResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationListResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationListResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationListResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationListResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.OperationTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + [System.ComponentModel.TypeConverter(typeof(OperationListResultTypeConverter))] + public partial interface IOperationListResult + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.TypeConverter.cs new file mode 100644 index 000000000000..57d478f3f89d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationListResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationListResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationListResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.cs new file mode 100644 index 000000000000..c724a4ff2270 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.cs @@ -0,0 +1,68 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + /// + public partial class OperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResultInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The URL to get the next set of operation list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[] _value; + + /// The list of operations supported by the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public OperationListResult() + { + + } + } + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + public partial interface IOperationListResult : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The URL to get the next set of operation list results if there are any. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The URL to get the next set of operation list results if there are any.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// The list of operations supported by the resource provider. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The list of operations supported by the resource provider.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[] Value { get; set; } + + } + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + public partial interface IOperationListResultInternal + + { + /// The URL to get the next set of operation list results if there are any. + string NextLink { get; set; } + /// The list of operations supported by the resource provider. + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.json.cs new file mode 100644 index 000000000000..ada726391799 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationListResult.json.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next + /// set of results. + /// + public partial class OperationListResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationListResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new OperationListResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal OperationListResult(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.Operation.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.PowerShell.cs new file mode 100644 index 000000000000..d460890851ba --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.PowerShell.cs @@ -0,0 +1,129 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Properties of the operation. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial class OperationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Properties of the operation. + [System.ComponentModel.TypeConverter(typeof(OperationPropertiesTypeConverter))] + public partial interface IOperationProperties + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.TypeConverter.cs new file mode 100644 index 000000000000..4ce0e0a7a70a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.cs new file mode 100644 index 000000000000..d7564c49a7a6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Properties of the operation. + public partial class OperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationPropertiesInternal + { + + /// Creates an new instance. + public OperationProperties() + { + + } + } + /// Properties of the operation. + public partial interface IOperationProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + + } + /// Properties of the operation. + public partial interface IOperationPropertiesInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.json.cs new file mode 100644 index 000000000000..e7f8440c3c37 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/OperationProperties.json.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Properties of the operation. + public partial class OperationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new OperationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal OperationProperties(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.PowerShell.cs new file mode 100644 index 000000000000..1cd28a280a78 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Purchase plan configuration for platform image. + [System.ComponentModel.TypeConverter(typeof(PlatformImagePurchasePlanTypeConverter))] + public partial class PlatformImagePurchasePlan + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PlatformImagePurchasePlan(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PlatformImagePurchasePlan(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PlatformImagePurchasePlan(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanName = (string) content.GetValueForProperty("PlanName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanProduct = (string) content.GetValueForProperty("PlanProduct",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanProduct, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanPublisher = (string) content.GetValueForProperty("PlanPublisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanPublisher, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PlatformImagePurchasePlan(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanName = (string) content.GetValueForProperty("PlanName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanProduct = (string) content.GetValueForProperty("PlanProduct",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanProduct, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanPublisher = (string) content.GetValueForProperty("PlanPublisher",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal)this).PlanPublisher, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Purchase plan configuration for platform image. + [System.ComponentModel.TypeConverter(typeof(PlatformImagePurchasePlanTypeConverter))] + public partial interface IPlatformImagePurchasePlan + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.TypeConverter.cs new file mode 100644 index 000000000000..779a809d2760 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PlatformImagePurchasePlanTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PlatformImagePurchasePlan.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PlatformImagePurchasePlan.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PlatformImagePurchasePlan.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.cs b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.cs new file mode 100644 index 000000000000..9cb3f24b99f0 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.cs @@ -0,0 +1,80 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Purchase plan configuration for platform image. + public partial class PlatformImagePurchasePlan : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlanInternal + { + + /// Backing field for property. + private string _planName; + + /// Name of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string PlanName { get => this._planName; set => this._planName = value; } + + /// Backing field for property. + private string _planProduct; + + /// Product of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string PlanProduct { get => this._planProduct; set => this._planProduct = value; } + + /// Backing field for property. + private string _planPublisher; + + /// Publisher of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string PlanPublisher { get => this._planPublisher; set => this._planPublisher = value; } + + /// Creates an new instance. + public PlatformImagePurchasePlan() + { + + } + } + /// Purchase plan configuration for platform image. + public partial interface IPlatformImagePurchasePlan : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Name of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the purchase plan.", + SerializedName = @"planName", + PossibleTypes = new [] { typeof(string) })] + string PlanName { get; set; } + /// Product of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Product of the purchase plan.", + SerializedName = @"planProduct", + PossibleTypes = new [] { typeof(string) })] + string PlanProduct { get; set; } + /// Publisher of the purchase plan. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Publisher of the purchase plan.", + SerializedName = @"planPublisher", + PossibleTypes = new [] { typeof(string) })] + string PlanPublisher { get; set; } + + } + /// Purchase plan configuration for platform image. + public partial interface IPlatformImagePurchasePlanInternal + + { + /// Name of the purchase plan. + string PlanName { get; set; } + /// Product of the purchase plan. + string PlanProduct { get; set; } + /// Publisher of the purchase plan. + string PlanPublisher { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.json.cs new file mode 100644 index 000000000000..a592491d5934 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/PlatformImagePurchasePlan.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Purchase plan configuration for platform image. + public partial class PlatformImagePurchasePlan + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IPlatformImagePurchasePlan FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new PlatformImagePurchasePlan(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal PlatformImagePurchasePlan(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_planName = If( json?.PropertyT("planName"), out var __jsonPlanName) ? (string)__jsonPlanName : (string)PlanName;} + {_planProduct = If( json?.PropertyT("planProduct"), out var __jsonPlanProduct) ? (string)__jsonPlanProduct : (string)PlanProduct;} + {_planPublisher = If( json?.PropertyT("planPublisher"), out var __jsonPlanPublisher) ? (string)__jsonPlanPublisher : (string)PlanPublisher;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._planName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._planName.ToString()) : null, "planName" ,container.Add ); + AddIf( null != (((object)this._planProduct)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._planProduct.ToString()) : null, "planProduct" ,container.Add ); + AddIf( null != (((object)this._planPublisher)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._planPublisher.ToString()) : null, "planPublisher" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.PowerShell.cs new file mode 100644 index 000000000000..a3888c156c18 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes the error happened when create or update an image template + [System.ComponentModel.TypeConverter(typeof(ProvisioningErrorTypeConverter))] + public partial class ProvisioningError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ProvisioningError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ProvisioningError(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ProvisioningError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Code = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Code, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ProvisioningError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Code = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode?) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal)this).Code, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode.CreateFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the error happened when create or update an image template + [System.ComponentModel.TypeConverter(typeof(ProvisioningErrorTypeConverter))] + public partial interface IProvisioningError + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.TypeConverter.cs new file mode 100644 index 000000000000..c9fedee404bf --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ProvisioningErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ProvisioningError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ProvisioningError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ProvisioningError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.cs new file mode 100644 index 000000000000..330b6ae06068 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the error happened when create or update an image template + public partial class ProvisioningError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningErrorInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? _code; + + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Creates an new instance. + public ProvisioningError() + { + + } + } + /// Describes the error happened when create or update an image template + public partial interface IProvisioningError : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Error code of the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Error code of the provisioning failure", + SerializedName = @"provisioningErrorCode", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? Code { get; set; } + /// Verbose error message about the provisioning failure + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Verbose error message about the provisioning failure", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + + } + /// Describes the error happened when create or update an image template + public partial interface IProvisioningErrorInternal + + { + /// Error code of the provisioning failure + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode? Code { get; set; } + /// Verbose error message about the provisioning failure + string Message { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.json.cs new file mode 100644 index 000000000000..851a18de40a6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ProvisioningError.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the error happened when create or update an image template + public partial class ProvisioningError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IProvisioningError FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ProvisioningError(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ProvisioningError(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_code = If( json?.PropertyT("provisioningErrorCode"), out var __jsonProvisioningErrorCode) ? (string)__jsonProvisioningErrorCode : (string)Code;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._code.ToString()) : null, "provisioningErrorCode" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Resource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.PowerShell.cs new file mode 100644 index 000000000000..f82a653ff6dd --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The Resource model definition. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTagsTypeConverter.ConvertFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The Resource model definition. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Resource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.TypeConverter.cs new file mode 100644 index 000000000000..da70d4e7d1d9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Resource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.cs new file mode 100644 index 000000000000..f808b7734b8e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The Resource model definition. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Backing field for property. + private string _location; + + /// Resource location + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags _tag; + + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// The Resource model definition. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource Id", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Resource location + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resource location", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Resource tags + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource tags", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags Tag { get; set; } + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The Resource model definition. + public partial interface IResourceInternal + + { + /// Resource Id + string Id { get; set; } + /// Resource location + string Location { get; set; } + /// Resource name + string Name { get; set; } + /// Resource tags + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags Tag { get; set; } + /// Resource type + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/Resource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.json.cs new file mode 100644 index 000000000000..4070b883a7d2 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/Resource.json.cs @@ -0,0 +1,118 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The Resource model definition. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.PowerShell.cs new file mode 100644 index 000000000000..f0db487f5f48 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(ResourceTagsTypeConverter))] + public partial class ResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource tags + [System.ComponentModel.TypeConverter(typeof(ResourceTagsTypeConverter))] + public partial interface IResourceTags + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.TypeConverter.cs new file mode 100644 index 000000000000..9d5f142b39c7 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.cs new file mode 100644 index 000000000000..ec246a82234e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.cs @@ -0,0 +1,30 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Resource tags + public partial class ResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTagsInternal + { + + /// Creates an new instance. + public ResourceTags() + { + + } + } + /// Resource tags + public partial interface IResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + + } + /// Resource tags + public partial interface IResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.dictionary.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.dictionary.cs new file mode 100644 index 000000000000..53cf8398ab21 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.json.cs new file mode 100644 index 000000000000..7c44ea45461c --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/ResourceTags.json.cs @@ -0,0 +1,102 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Resource tags + public partial class ResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ResourceTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + /// + internal ResourceTags(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.PowerShell.cs new file mode 100644 index 000000000000..bf76d64111a9 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Represents an output that was created by running an image template. + [System.ComponentModel.TypeConverter(typeof(RunOutputTypeConverter))] + public partial class RunOutput + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RunOutput(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RunOutput(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RunOutput(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactId = (string) content.GetValueForProperty("ArtifactId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactUri = (string) content.GetValueForProperty("ArtifactUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactUri, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RunOutput(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactId = (string) content.GetValueForProperty("ArtifactId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactUri = (string) content.GetValueForProperty("ArtifactUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal)this).ArtifactUri, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Represents an output that was created by running an image template. + [System.ComponentModel.TypeConverter(typeof(RunOutputTypeConverter))] + public partial interface IRunOutput + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.TypeConverter.cs new file mode 100644 index 000000000000..171d0a359eb4 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RunOutputTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RunOutput.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RunOutput.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RunOutput.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.cs new file mode 100644 index 000000000000..bddffc25c693 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Represents an output that was created by running an image template. + public partial class RunOutput : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource __subResource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource(); + + /// The resource id of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string ArtifactId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ArtifactId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ArtifactId = value; } + + /// The location URI of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public string ArtifactUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ArtifactUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ArtifactUri = value; } + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Id; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Id = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Type = value; } + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties _property; + + /// The properties of the run output + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties()); set => this._property = value; } + + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)Property).ProvisioningState; } + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)__subResource).Type; } + + /// Creates an new instance. + public RunOutput() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__subResource), __subResource); + await eventListener.AssertObjectIsValid(nameof(__subResource), __subResource); + } + } + /// Represents an output that was created by running an image template. + public partial interface IRunOutput : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource + { + /// The resource id of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the artifact.", + SerializedName = @"artifactId", + PossibleTypes = new [] { typeof(string) })] + string ArtifactId { get; set; } + /// The location URI of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location URI of the artifact.", + SerializedName = @"artifactUri", + PossibleTypes = new [] { typeof(string) })] + string ArtifactUri { get; set; } + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the resource", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; } + + } + /// Represents an output that was created by running an image template. + public partial interface IRunOutputInternal : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal + { + /// The resource id of the artifact. + string ArtifactId { get; set; } + /// The location URI of the artifact. + string ArtifactUri { get; set; } + /// The properties of the run output + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties Property { get; set; } + /// Provisioning state of the resource + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.json.cs new file mode 100644 index 000000000000..10894041a105 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutput.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Represents an output that was created by running an image template. + public partial class RunOutput + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new RunOutput(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal RunOutput(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __subResource = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.SubResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputProperties.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __subResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.PowerShell.cs new file mode 100644 index 000000000000..cc514277577e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The result of List run outputs operation + [System.ComponentModel.TypeConverter(typeof(RunOutputCollectionTypeConverter))] + public partial class RunOutputCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RunOutputCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RunOutputCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RunOutputCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RunOutputCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutputTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The result of List run outputs operation + [System.ComponentModel.TypeConverter(typeof(RunOutputCollectionTypeConverter))] + public partial interface IRunOutputCollection + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.TypeConverter.cs new file mode 100644 index 000000000000..7490c14136db --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RunOutputCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RunOutputCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RunOutputCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RunOutputCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.cs new file mode 100644 index 000000000000..92a02adf2a4b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The result of List run outputs operation + public partial class RunOutputCollection : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// The continuation token. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[] _value; + + /// An array of run outputs + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public RunOutputCollection() + { + + } + } + /// The result of List run outputs operation + public partial interface IRunOutputCollection : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The continuation token. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The continuation token.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// An array of run outputs + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An array of run outputs", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[] Value { get; set; } + + } + /// The result of List run outputs operation + public partial interface IRunOutputCollectionInternal + + { + /// The continuation token. + string NextLink { get; set; } + /// An array of run outputs + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.json.cs new file mode 100644 index 000000000000..15245014cc4e --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputCollection.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The result of List run outputs operation + public partial class RunOutputCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new RunOutputCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal RunOutputCollection(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput) (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.RunOutput.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.PowerShell.cs new file mode 100644 index 000000000000..70e9f58117ab --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Describes the properties of a run output + [System.ComponentModel.TypeConverter(typeof(RunOutputPropertiesTypeConverter))] + public partial class RunOutputProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new RunOutputProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new RunOutputProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal RunOutputProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactId = (string) content.GetValueForProperty("ArtifactId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactUri = (string) content.GetValueForProperty("ArtifactUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal RunOutputProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactId = (string) content.GetValueForProperty("ArtifactId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactUri = (string) content.GetValueForProperty("ArtifactUri",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ArtifactUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState.CreateFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the properties of a run output + [System.ComponentModel.TypeConverter(typeof(RunOutputPropertiesTypeConverter))] + public partial interface IRunOutputProperties + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.TypeConverter.cs new file mode 100644 index 000000000000..281308943e2a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class RunOutputPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return RunOutputProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return RunOutputProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return RunOutputProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.cs new file mode 100644 index 000000000000..474ba0b52f0d --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.cs @@ -0,0 +1,83 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the properties of a run output + public partial class RunOutputProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal + { + + /// Backing field for property. + private string _artifactId; + + /// The resource id of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ArtifactId { get => this._artifactId; set => this._artifactId = value; } + + /// Backing field for property. + private string _artifactUri; + + /// The location URI of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ArtifactUri { get => this._artifactUri; set => this._artifactUri = value; } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? _provisioningState; + + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Creates an new instance. + public RunOutputProperties() + { + + } + } + /// Describes the properties of a run output + public partial interface IRunOutputProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// The resource id of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource id of the artifact.", + SerializedName = @"artifactId", + PossibleTypes = new [] { typeof(string) })] + string ArtifactId { get; set; } + /// The location URI of the artifact. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The location URI of the artifact.", + SerializedName = @"artifactUri", + PossibleTypes = new [] { typeof(string) })] + string ArtifactUri { get; set; } + /// Provisioning state of the resource + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Provisioning state of the resource", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; } + + } + /// Describes the properties of a run output + public partial interface IRunOutputPropertiesInternal + + { + /// The resource id of the artifact. + string ArtifactId { get; set; } + /// The location URI of the artifact. + string ArtifactUri { get; set; } + /// Provisioning state of the resource + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState? ProvisioningState { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.json.cs new file mode 100644 index 000000000000..b8f02c298896 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/RunOutputProperties.json.cs @@ -0,0 +1,108 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Describes the properties of a run output + public partial class RunOutputProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutputProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new RunOutputProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal RunOutputProperties(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_artifactId = If( json?.PropertyT("artifactId"), out var __jsonArtifactId) ? (string)__jsonArtifactId : (string)ArtifactId;} + {_artifactUri = If( json?.PropertyT("artifactUri"), out var __jsonArtifactUri) ? (string)__jsonArtifactUri : (string)ArtifactUri;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._artifactId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._artifactId.ToString()) : null, "artifactId" ,container.Add ); + AddIf( null != (((object)this._artifactUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._artifactUri.ToString()) : null, "artifactUri" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.PowerShell.cs new file mode 100644 index 000000000000..82f878920b4a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// The Sub Resource model definition. + [System.ComponentModel.TypeConverter(typeof(SubResourceTypeConverter))] + public partial class SubResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SubResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SubResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SubResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SubResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The Sub Resource model definition. + [System.ComponentModel.TypeConverter(typeof(SubResourceTypeConverter))] + public partial interface ISubResource + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.TypeConverter.cs new file mode 100644 index 000000000000..8b2c065678ec --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SubResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SubResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SubResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SubResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.cs b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.cs new file mode 100644 index 000000000000..482c34b0cb97 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.cs @@ -0,0 +1,86 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The Sub Resource model definition. + public partial class SubResource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public SubResource() + { + + } + } + /// The Sub Resource model definition. + public partial interface ISubResource : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Resource Id + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource Id", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// Resource name + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Resource name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Resource type + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Resource type", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The Sub Resource model definition. + public partial interface ISubResourceInternal + + { + /// Resource Id + string Id { get; set; } + /// Resource name + string Name { get; set; } + /// Resource type + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.json.cs new file mode 100644 index 000000000000..f046d25dc3cd --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/SubResource.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// The Sub Resource model definition. + public partial class SubResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.ISubResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new SubResource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal SubResource(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.PowerShell.cs b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.PowerShell.cs new file mode 100644 index 000000000000..767b54b0f291 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.PowerShell.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// Virtual Network configuration. + [System.ComponentModel.TypeConverter(typeof(VirtualNetworkConfigTypeConverter))] + public partial class VirtualNetworkConfig + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new VirtualNetworkConfig(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new VirtualNetworkConfig(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal VirtualNetworkConfig(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)this).SubnetId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal VirtualNetworkConfig(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)this).SubnetId = (string) content.GetValueForProperty("SubnetId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal)this).SubnetId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Virtual Network configuration. + [System.ComponentModel.TypeConverter(typeof(VirtualNetworkConfigTypeConverter))] + public partial interface IVirtualNetworkConfig + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.TypeConverter.cs new file mode 100644 index 000000000000..e5a5ae0db852 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class VirtualNetworkConfigTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return VirtualNetworkConfig.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return VirtualNetworkConfig.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return VirtualNetworkConfig.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.cs b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.cs new file mode 100644 index 000000000000..26763e00d593 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Virtual Network configuration. + public partial class VirtualNetworkConfig : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfigInternal + { + + /// Backing field for property. + private string _subnetId; + + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string SubnetId { get => this._subnetId; set => this._subnetId = value; } + + /// Creates an new instance. + public VirtualNetworkConfig() + { + + } + } + /// Virtual Network configuration. + public partial interface IVirtualNetworkConfig : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Resource id of a pre-existing subnet. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource id of a pre-existing subnet.", + SerializedName = @"subnetId", + PossibleTypes = new [] { typeof(string) })] + string SubnetId { get; set; } + + } + /// Virtual Network configuration. + public partial interface IVirtualNetworkConfigInternal + + { + /// Resource id of a pre-existing subnet. + string SubnetId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.json.cs b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.json.cs new file mode 100644 index 000000000000..c9e50321116a --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/Api20200214/VirtualNetworkConfig.json.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Virtual Network configuration. + public partial class VirtualNetworkConfig + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IVirtualNetworkConfig FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new VirtualNetworkConfig(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._subnetId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._subnetId.ToString()) : null, "subnetId" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal VirtualNetworkConfig(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_subnetId = If( json?.PropertyT("subnetId"), out var __jsonSubnetId) ? (string)__jsonSubnetId : (string)SubnetId;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.PowerShell.cs b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.PowerShell.cs new file mode 100644 index 000000000000..dd1ded2b753b --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.PowerShell.cs @@ -0,0 +1,142 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ImageBuilderIdentityTypeConverter))] + public partial class ImageBuilderIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImageBuilderIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImageBuilderIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImageBuilderIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ImageTemplateName = (string) content.GetValueForProperty("ImageTemplateName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ImageTemplateName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).RunOutputName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImageBuilderIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ImageTemplateName = (string) content.GetValueForProperty("ImageTemplateName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ImageTemplateName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).RunOutputName = (string) content.GetValueForProperty("RunOutputName",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).RunOutputName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ImageBuilderIdentityTypeConverter))] + public partial interface IImageBuilderIdentity + + { + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.TypeConverter.cs b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.TypeConverter.cs new file mode 100644 index 000000000000..e37fe2e313a6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImageBuilderIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new ImageBuilderIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImageBuilderIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImageBuilderIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImageBuilderIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.cs b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.cs new file mode 100644 index 000000000000..728217bdddcf --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.cs @@ -0,0 +1,125 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ImageBuilderIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentityInternal + { + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _runOutputName; + + /// The name of the run output + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string RunOutputName { get => this._runOutputName; set => this._runOutputName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public ImageBuilderIdentity() + { + + } + } + public partial interface IImageBuilderIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable + { + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The name of the image Template + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + string ImageTemplateName { get; set; } + /// The name of the resource group. + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// The name of the run output + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the run output", + SerializedName = @"runOutputName", + PossibleTypes = new [] { typeof(string) })] + string RunOutputName { get; set; } + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + public partial interface IImageBuilderIdentityInternal + + { + /// Resource identity path + string Id { get; set; } + /// The name of the image Template + string ImageTemplateName { get; set; } + /// The name of the resource group. + string ResourceGroupName { get; set; } + /// The name of the run output + string RunOutputName { get; set; } + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.json.cs b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.json.cs new file mode 100644 index 000000000000..205ee1771618 --- /dev/null +++ b/src/ImageBuilder/generated/api/Models/ImageBuilderIdentity.json.cs @@ -0,0 +1,113 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public partial class ImageBuilderIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new ImageBuilderIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject instance to deserialize from. + internal ImageBuilderIdentity(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_imageTemplateName = If( json?.PropertyT("imageTemplateName"), out var __jsonImageTemplateName) ? (string)__jsonImageTemplateName : (string)ImageTemplateName;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_runOutputName = If( json?.PropertyT("runOutputName"), out var __jsonRunOutputName) ? (string)__jsonRunOutputName : (string)RunOutputName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._imageTemplateName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._imageTemplateName.ToString()) : null, "imageTemplateName" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._runOutputName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._runOutputName.ToString()) : null, "runOutputName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.Completer.cs b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.Completer.cs new file mode 100644 index 000000000000..cb0ea6088879 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.Completer.cs @@ -0,0 +1,75 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for ProvisioningErrorCode. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCodeTypeConverter))] + public partial struct ProvisioningErrorCode : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadSourceType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadSourceType", "BadSourceType", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadSourceType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadPIRSource".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadPIRSource", "BadPIRSource", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadPIRSource"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadManagedImageSource".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadManagedImageSource", "BadManagedImageSource", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadManagedImageSource"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadSharedImageVersionSource".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadSharedImageVersionSource", "BadSharedImageVersionSource", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadSharedImageVersionSource"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadCustomizerType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadCustomizerType", "BadCustomizerType", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadCustomizerType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UnsupportedCustomizerType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("UnsupportedCustomizerType", "UnsupportedCustomizerType", global::System.Management.Automation.CompletionResultType.ParameterValue, "UnsupportedCustomizerType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NoCustomizerScript".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NoCustomizerScript", "NoCustomizerScript", global::System.Management.Automation.CompletionResultType.ParameterValue, "NoCustomizerScript"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadDistributeType".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadDistributeType", "BadDistributeType", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadDistributeType"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "BadSharedImageDistribute".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("BadSharedImageDistribute", "BadSharedImageDistribute", global::System.Management.Automation.CompletionResultType.ParameterValue, "BadSharedImageDistribute"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ServerError".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("ServerError", "ServerError", global::System.Management.Automation.CompletionResultType.ParameterValue, "ServerError"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Other".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Other", "Other", global::System.Management.Automation.CompletionResultType.ParameterValue, "Other"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.TypeConverter.cs new file mode 100644 index 000000000000..d73b283ed306 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for ProvisioningErrorCode. + public partial class ProvisioningErrorCodeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningErrorCode.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.cs b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.cs new file mode 100644 index 000000000000..f41334b45de3 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningErrorCode.cs @@ -0,0 +1,115 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct ProvisioningErrorCode : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadCustomizerType = @"BadCustomizerType"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadDistributeType = @"BadDistributeType"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadManagedImageSource = @"BadManagedImageSource"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadPirSource = @"BadPIRSource"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadSharedImageDistribute = @"BadSharedImageDistribute"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadSharedImageVersionSource = @"BadSharedImageVersionSource"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode BadSourceType = @"BadSourceType"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode NoCustomizerScript = @"NoCustomizerScript"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode Other = @"Other"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode ServerError = @"ServerError"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode UnsupportedCustomizerType = @"UnsupportedCustomizerType"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProvisioningErrorCode + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProvisioningErrorCode(System.Convert.ToString(value)); + } + + /// Compares values of enum type ProvisioningErrorCode + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProvisioningErrorCode (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProvisioningErrorCode && Equals((ProvisioningErrorCode)obj); + } + + /// Returns hashCode for enum ProvisioningErrorCode + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private ProvisioningErrorCode(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProvisioningErrorCode + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProvisioningErrorCode + /// the value to convert to an instance of . + + public static implicit operator ProvisioningErrorCode(string value) + { + return new ProvisioningErrorCode(value); + } + + /// Implicit operator to convert ProvisioningErrorCode to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e) + { + return e._value; + } + + /// Overriding != operator for enum ProvisioningErrorCode + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProvisioningErrorCode + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningState.Completer.cs b/src/ImageBuilder/generated/api/Support/ProvisioningState.Completer.cs new file mode 100644 index 000000000000..e18902471980 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningState.Completer.cs @@ -0,0 +1,51 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for ProvisioningState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningStateTypeConverter))] + public partial struct ProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Creating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Creating", "Creating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Creating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Updating", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Deleting", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningState.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/ProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..bf1eba649695 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for ProvisioningState. + public partial class ProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ProvisioningState.cs b/src/ImageBuilder/generated/api/Support/ProvisioningState.cs new file mode 100644 index 000000000000..93b5aa5b0f80 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ProvisioningState.cs @@ -0,0 +1,103 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct ProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState Creating = @"Creating"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState Updating = @"Updating"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ProvisioningState(System.Convert.ToString(value)); + } + + /// Compares values of enum type ProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ProvisioningState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ProvisioningState && Equals((ProvisioningState)obj); + } + + /// Returns hashCode for enum ProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private ProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ProvisioningState + /// the value to convert to an instance of . + + public static implicit operator ProvisioningState(string value) + { + return new ProvisioningState(value); + } + + /// Implicit operator to convert ProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum ProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ResourceIdentityType.Completer.cs b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.Completer.cs new file mode 100644 index 000000000000..57d77facec36 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.Completer.cs @@ -0,0 +1,39 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for ResourceIdentityType. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityTypeTypeConverter))] + public partial struct ResourceIdentityType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "UserAssigned".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("UserAssigned", "UserAssigned", global::System.Management.Automation.CompletionResultType.ParameterValue, "UserAssigned"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "None".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("None", "None", global::System.Management.Automation.CompletionResultType.ParameterValue, "None"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ResourceIdentityType.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.TypeConverter.cs new file mode 100644 index 000000000000..c837d43efe2b --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for ResourceIdentityType. + public partial class ResourceIdentityTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ResourceIdentityType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/ResourceIdentityType.cs b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.cs new file mode 100644 index 000000000000..5c5c69a914bf --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/ResourceIdentityType.cs @@ -0,0 +1,97 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct ResourceIdentityType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType None = @"None"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType UserAssigned = @"UserAssigned"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to ResourceIdentityType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new ResourceIdentityType(System.Convert.ToString(value)); + } + + /// Compares values of enum type ResourceIdentityType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type ResourceIdentityType (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is ResourceIdentityType && Equals((ResourceIdentityType)obj); + } + + /// Returns hashCode for enum ResourceIdentityType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private ResourceIdentityType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for ResourceIdentityType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to ResourceIdentityType + /// the value to convert to an instance of . + + public static implicit operator ResourceIdentityType(string value) + { + return new ResourceIdentityType(value); + } + + /// Implicit operator to convert ResourceIdentityType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e) + { + return e._value; + } + + /// Overriding != operator for enum ResourceIdentityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum ResourceIdentityType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ResourceIdentityType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunState.Completer.cs b/src/ImageBuilder/generated/api/Support/RunState.Completer.cs new file mode 100644 index 000000000000..2401a9281ceb --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunState.Completer.cs @@ -0,0 +1,55 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for RunState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunStateTypeConverter))] + public partial struct RunState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Running".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Running", "Running", global::System.Management.Automation.CompletionResultType.ParameterValue, "Running"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Canceling".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Canceling", "Canceling", global::System.Management.Automation.CompletionResultType.ParameterValue, "Canceling"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "PartiallySucceeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("PartiallySucceeded", "PartiallySucceeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "PartiallySucceeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Canceled".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Canceled", "Canceled", global::System.Management.Automation.CompletionResultType.ParameterValue, "Canceled"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunState.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/RunState.TypeConverter.cs new file mode 100644 index 000000000000..bc2da360b258 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for RunState. + public partial class RunStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RunState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunState.cs b/src/ImageBuilder/generated/api/Support/RunState.cs new file mode 100644 index 000000000000..61f95066fa99 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunState.cs @@ -0,0 +1,105 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct RunState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState Canceled = @"Canceled"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState Canceling = @"Canceling"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState PartiallySucceeded = @"PartiallySucceeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState Running = @"Running"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState Succeeded = @"Succeeded"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RunState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RunState(System.Convert.ToString(value)); + } + + /// Compares values of enum type RunState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RunState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RunState && Equals((RunState)obj); + } + + /// Returns hashCode for enum RunState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private RunState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RunState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RunState + /// the value to convert to an instance of . + + public static implicit operator RunState(string value) + { + return new RunState(value); + } + + /// Implicit operator to convert RunState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e) + { + return e._value; + } + + /// Overriding != operator for enum RunState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RunState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunSubState.Completer.cs b/src/ImageBuilder/generated/api/Support/RunSubState.Completer.cs new file mode 100644 index 000000000000..6a8c38afaad6 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunSubState.Completer.cs @@ -0,0 +1,47 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for RunSubState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubStateTypeConverter))] + public partial struct RunSubState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Queued".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Queued", "Queued", global::System.Management.Automation.CompletionResultType.ParameterValue, "Queued"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Building".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Building", "Building", global::System.Management.Automation.CompletionResultType.ParameterValue, "Building"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Customizing".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Customizing", "Customizing", global::System.Management.Automation.CompletionResultType.ParameterValue, "Customizing"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Distributing".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Distributing", "Distributing", global::System.Management.Automation.CompletionResultType.ParameterValue, "Distributing"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunSubState.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/RunSubState.TypeConverter.cs new file mode 100644 index 000000000000..55fa5bacc635 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunSubState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for RunSubState. + public partial class RunSubStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => RunSubState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/RunSubState.cs b/src/ImageBuilder/generated/api/Support/RunSubState.cs new file mode 100644 index 000000000000..63abc1708067 --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/RunSubState.cs @@ -0,0 +1,101 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct RunSubState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState Building = @"Building"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState Customizing = @"Customizing"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState Distributing = @"Distributing"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState Queued = @"Queued"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to RunSubState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new RunSubState(System.Convert.ToString(value)); + } + + /// Compares values of enum type RunSubState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type RunSubState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is RunSubState && Equals((RunSubState)obj); + } + + /// Returns hashCode for enum RunSubState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private RunSubState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for RunSubState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to RunSubState + /// the value to convert to an instance of . + + public static implicit operator RunSubState(string value) + { + return new RunSubState(value); + } + + /// Implicit operator to convert RunSubState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e) + { + return e._value; + } + + /// Overriding != operator for enum RunSubState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum RunSubState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.Completer.cs b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.Completer.cs new file mode 100644 index 000000000000..025734b1bede --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.Completer.cs @@ -0,0 +1,39 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// Argument completer implementation for SharedImageStorageAccountType. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountTypeTypeConverter))] + public partial struct SharedImageStorageAccountType : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_LRS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Standard_LRS", "Standard_LRS", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_LRS"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Standard_ZRS".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Standard_ZRS", "Standard_ZRS", global::System.Management.Automation.CompletionResultType.ParameterValue, "Standard_ZRS"); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.TypeConverter.cs b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.TypeConverter.cs new file mode 100644 index 000000000000..9639e87f5d4e --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + /// TypeConverter implementation for SharedImageStorageAccountType. + public partial class SharedImageStorageAccountTypeTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => SharedImageStorageAccountType.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.cs b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.cs new file mode 100644 index 000000000000..5567ee06db5c --- /dev/null +++ b/src/ImageBuilder/generated/api/Support/SharedImageStorageAccountType.cs @@ -0,0 +1,103 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support +{ + + public partial struct SharedImageStorageAccountType : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType StandardLrs = @"Standard_LRS"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType StandardZrs = @"Standard_ZRS"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// Conversion from arbitrary object to SharedImageStorageAccountType + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new SharedImageStorageAccountType(System.Convert.ToString(value)); + } + + /// Compares values of enum type SharedImageStorageAccountType + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type SharedImageStorageAccountType (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is SharedImageStorageAccountType && Equals((SharedImageStorageAccountType)obj); + } + + /// Returns hashCode for enum SharedImageStorageAccountType + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// + /// Creates an instance of the + /// + /// the value to create an instance for. + private SharedImageStorageAccountType(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for SharedImageStorageAccountType + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to SharedImageStorageAccountType + /// the value to convert to an instance of . + + public static implicit operator SharedImageStorageAccountType(string value) + { + return new SharedImageStorageAccountType(value); + } + + /// Implicit operator to convert SharedImageStorageAccountType to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e) + { + return e._value; + } + + /// Overriding != operator for enum SharedImageStorageAccountType + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum SharedImageStorageAccountType + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e1, Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_Get.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_Get.cs new file mode 100644 index 000000000000..05b264cb64f6 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_Get.cs @@ -0,0 +1,415 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Get the specified run output for the specified image template resource + /// + /// [OpenAPI] VirtualMachineImageTemplates_GetRunOutput=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderRunOutput_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Get the specified run output for the specified image template resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderRunOutput_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _runOutputName; + + /// The name of the run output + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the run output")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the run output", + SerializedName = @"runOutputName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string RunOutputName { get => this._runOutputName; set => this._runOutputName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderRunOutput_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesGetRunOutput(SubscriptionId, ResourceGroupName, ImageTemplateName, RunOutputName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName,RunOutputName=RunOutputName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName, RunOutputName=RunOutputName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName, RunOutputName=RunOutputName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_GetViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_GetViaIdentity.cs new file mode 100644 index 000000000000..e2a039ea34cd --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_GetViaIdentity.cs @@ -0,0 +1,381 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Get the specified run output for the specified image template resource + /// + /// [OpenAPI] VirtualMachineImageTemplates_GetRunOutput=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderRunOutput_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Get the specified run output for the specified image template resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderRunOutput_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderRunOutput_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesGetRunOutputViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.RunOutputName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.RunOutputName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesGetRunOutput(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, InputObject.RunOutputName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_List.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_List.cs new file mode 100644 index 000000000000..928561df810d --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderRunOutput_List.cs @@ -0,0 +1,412 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// List all run outputs for the specified Image Template resource + /// + /// [OpenAPI] VirtualMachineImageTemplates_ListRunOutputs=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderRunOutput_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"List all run outputs for the specified Image Template resource")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderRunOutput_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderRunOutput_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesListRunOutputs(SubscriptionId, ResourceGroupName, ImageTemplateName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesListRunOutputs_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_Get.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_Get.cs new file mode 100644 index 000000000000..3459f9b492cb --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_Get.cs @@ -0,0 +1,402 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Get information about a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderTemplate_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Get information about a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderTemplate_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("Name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderTemplate_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesGet(SubscriptionId, ResourceGroupName, ImageTemplateName, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_GetViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_GetViaIdentity.cs new file mode 100644 index 000000000000..3a1390ed6670 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_GetViaIdentity.cs @@ -0,0 +1,377 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Get information about a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderTemplate_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Get information about a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderTemplate_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderTemplate_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesGetViaIdentity(InputObject.Id, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesGet(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List.cs new file mode 100644 index 000000000000..0db49fb42d1b --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List.cs @@ -0,0 +1,384 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Gets information about the VM image templates associated with the subscription. + /// + /// [OpenAPI] VirtualMachineImageTemplates_List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderTemplate_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Gets information about the VM image templates associated with the subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderTemplate_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderTemplate_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesList(SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List1.cs b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List1.cs new file mode 100644 index 000000000000..27fe31f26609 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzImageBuilderTemplate_List1.cs @@ -0,0 +1,400 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// + /// Gets information about the VM image templates associated with the specified resource group. + /// + /// + /// [OpenAPI] VirtualMachineImageTemplates_ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImageBuilderTemplate_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Gets information about the VM image templates associated with the specified resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzImageBuilderTemplate_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImageBuilderTemplate_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesListByResourceGroup(ResourceGroupName, SubscriptionId, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { ResourceGroupName=ResourceGroupName, SubscriptionId=SubscriptionId }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/GetAzOperation_List.cs b/src/ImageBuilder/generated/cmdlets/GetAzOperation_List.cs new file mode 100644 index 000000000000..c35d08ddba38 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/GetAzOperation_List.cs @@ -0,0 +1,361 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Lists available operations for the Microsoft.VirtualMachineImages provider + /// + /// [OpenAPI] Operations_List=>GET:"/providers/Microsoft.VirtualMachineImages/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Lists available operations for the Microsoft.VirtualMachineImages provider")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class GetAzOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_Create.cs b/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_Create.cs new file mode 100644 index 000000000000..6a8ea32b228d --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_Create.cs @@ -0,0 +1,485 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Create or update a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzImageBuilderTemplate_Create", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Create or update a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class NewAzImageBuilderTemplate_Create : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("Name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate _parameter; + + /// + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider", + SerializedName = @"parameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate Parameter { get => this._parameter; set => this._parameter = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzImageBuilderTemplate_Create + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.NewAzImageBuilderTemplate_Create Clone() + { + var clone = new NewAzImageBuilderTemplate_Create(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.ImageTemplateName = this.ImageTemplateName; + clone.Parameter = this.Parameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzImageBuilderTemplate_Create() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesCreateOrUpdate(SubscriptionId, ResourceGroupName, ImageTemplateName, Parameter, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName,body=Parameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName, body=Parameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName, body=Parameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_CreateViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_CreateViaIdentity.cs new file mode 100644 index 000000000000..b7ddf807fee1 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/NewAzImageBuilderTemplate_CreateViaIdentity.cs @@ -0,0 +1,460 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Create or update a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzImageBuilderTemplate_CreateViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Create or update a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class NewAzImageBuilderTemplate_CreateViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate _parameter; + + /// + /// Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider", ValueFromPipeline = true)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider", + SerializedName = @"parameters", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate Parameter { get => this._parameter; set => this._parameter = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzImageBuilderTemplate_CreateViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.NewAzImageBuilderTemplate_CreateViaIdentity Clone() + { + var clone = new NewAzImageBuilderTemplate_CreateViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Parameter = this.Parameter; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzImageBuilderTemplate_CreateViaIdentity() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesCreateOrUpdate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesCreateOrUpdateViaIdentity(InputObject.Id, Parameter, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesCreateOrUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, Parameter, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Parameter}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Parameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=Parameter }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_Delete.cs b/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_Delete.cs new file mode 100644 index 000000000000..b0f166fe405b --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_Delete.cs @@ -0,0 +1,507 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Delete a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzImageBuilderTemplate_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Delete a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class RemoveAzImageBuilderTemplate_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("Name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzImageBuilderTemplate_Delete + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.RemoveAzImageBuilderTemplate_Delete Clone() + { + var clone = new RemoveAzImageBuilderTemplate_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.ImageTemplateName = this.ImageTemplateName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesDelete(SubscriptionId, ResourceGroupName, ImageTemplateName, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzImageBuilderTemplate_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_DeleteViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_DeleteViaIdentity.cs new file mode 100644 index 000000000000..81c8cbb68d20 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/RemoveAzImageBuilderTemplate_DeleteViaIdentity.cs @@ -0,0 +1,482 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Delete a virtual machine image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzImageBuilderTemplate_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Delete a virtual machine image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class RemoveAzImageBuilderTemplate_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzImageBuilderTemplate_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.RemoveAzImageBuilderTemplate_DeleteViaIdentity Clone() + { + var clone = new RemoveAzImageBuilderTemplate_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesDeleteViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesDelete(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzImageBuilderTemplate_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_Run.cs b/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_Run.cs new file mode 100644 index 000000000000..e2f150b94b28 --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_Run.cs @@ -0,0 +1,507 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Create artifacts from a existing image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Run=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzImageBuilderTemplate_Run", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Create artifacts from a existing image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class StartAzImageBuilderTemplate_Run : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("Name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StartAzImageBuilderTemplate_Run + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.StartAzImageBuilderTemplate_Run Clone() + { + var clone = new StartAzImageBuilderTemplate_Run(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.ImageTemplateName = this.ImageTemplateName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesRun' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesRun(SubscriptionId, ResourceGroupName, ImageTemplateName, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzImageBuilderTemplate_Run() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_RunViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_RunViaIdentity.cs new file mode 100644 index 000000000000..4e218e87b44b --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/StartAzImageBuilderTemplate_RunViaIdentity.cs @@ -0,0 +1,482 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Create artifacts from a existing image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Run=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Start, @"AzImageBuilderTemplate_RunViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Create artifacts from a existing image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class StartAzImageBuilderTemplate_RunViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StartAzImageBuilderTemplate_RunViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.StartAzImageBuilderTemplate_RunViaIdentity Clone() + { + var clone = new StartAzImageBuilderTemplate_RunViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesRun' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesRunViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesRun(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StartAzImageBuilderTemplate_RunViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_Cancel.cs b/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_Cancel.cs new file mode 100644 index 000000000000..9ae0f25312bb --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_Cancel.cs @@ -0,0 +1,507 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Cancel the long running image build based on the image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzImageBuilderTemplate_Cancel", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Cancel the long running image build based on the image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class StopAzImageBuilderTemplate_Cancel : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private string _imageTemplateName; + + /// The name of the image Template + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the image Template")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the image Template", + SerializedName = @"imageTemplateName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("Name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ImageTemplateName { get => this._imageTemplateName; set => this._imageTemplateName = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// The name of the resource group. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI + /// for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzImageBuilderTemplate_Cancel + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.StopAzImageBuilderTemplate_Cancel Clone() + { + var clone = new StopAzImageBuilderTemplate_Cancel(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.ImageTemplateName = this.ImageTemplateName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.VirtualMachineImageTemplatesCancel(SubscriptionId, ResourceGroupName, ImageTemplateName, onOk, onNoContent, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,ImageTemplateName=ImageTemplateName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzImageBuilderTemplate_Cancel() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, ImageTemplateName=ImageTemplateName }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_CancelViaIdentity.cs b/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_CancelViaIdentity.cs new file mode 100644 index 000000000000..bd22564fcfcb --- /dev/null +++ b/src/ImageBuilder/generated/cmdlets/StopAzImageBuilderTemplate_CancelViaIdentity.cs @@ -0,0 +1,482 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + /// Cancel the long running image build based on the image template + /// + /// [OpenAPI] VirtualMachineImageTemplates_Cancel=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsLifecycle.Stop, @"AzImageBuilderTemplate_CancelViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Description(@"Cancel the long running image build based on the image template")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Generated] + public partial class StopAzImageBuilderTemplate_CancelViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ImageBuilder Client => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of StopAzImageBuilderTemplate_CancelViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Cmdlets.StopAzImageBuilderTemplate_CancelViaIdentity Clone() + { + var clone = new StopAzImageBuilderTemplate_CancelViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"azure-asyncoperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'VirtualMachineImageTemplatesCancel' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.VirtualMachineImageTemplatesCancelViaIdentity(InputObject.Id, onOk, onNoContent, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ImageTemplateName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ImageTemplateName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.VirtualMachineImageTemplatesCancel(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ImageTemplateName ?? null, onOk, onNoContent, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public StopAzImageBuilderTemplate_CancelViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/AsyncCommandRuntime.cs b/src/ImageBuilder/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..9d2bc1f91836 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,828 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/AsyncJob.cs b/src/ImageBuilder/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..9a14196d1227 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/AsyncOperationResponse.cs b/src/ImageBuilder/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..4a9db0e25519 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..514381daa61f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..41ce4e3f9440 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..0df05d6d63f4 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support"; + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!IsAzure || pf.Property.Name != "Id") + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..8362d42b626e --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..04816cd41fe1 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..ccde51db7002 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append(@" +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +"); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } catch (Exception ee) { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..0aad0dbfa1fe --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,125 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.ImageBuilder.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: ImageBuilder cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.ImageBuilder.private.dll"}'"); + + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.ImageBuilder.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule ImageBuilder".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..7e124d80e2fe --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,137 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine(@"$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath)" +); + sb.AppendLine($@"$TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@"$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName +"); + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..69d4b6042f88 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..b53edf49d419 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..5dfc0d6d3cfc --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/CollectionExtensions.cs b/src/ImageBuilder/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..a9437b252531 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/ImageBuilder/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..8214452d937e --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + if (markdownInfo.SupportsPaging) + { + foreach (var parameter in SupportsPagingParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"### {alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..2167202c647b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..fd519c00ae05 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name} +{ExampleCodeHeader} +{ExampleInfo.Code} +{ExampleCodeFooter} + +{ExampleInfo.Description.ToDescriptionFormat()} + +"; + } + + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Description.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..ebd6e89d2f54 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..aaf0381f7a38 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,291 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (codeEndIndex ?? 0) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + if (Variant.SupportsPaging) + { + parameterStrings = parameterStrings.Append(" [-First ]").Append(" [-IncludeTotalCount]").Append(" [-Skip ]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string description) + { + Name = name; + Code = code; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}") + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..7c887873808b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,513 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BeginOutput + { + public VariantGroup VariantGroup { get; } + + public BeginOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput + { + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + } + + internal class EndOutput + { + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new [] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new []{"
", "\r\n", "\n"}); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..c8c0dcf36d98 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,499 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{variantGroup.ModuleName.ToLowerInvariant()}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => !ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)); + } + return parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))).ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/PsAttributes.cs b/src/ImageBuilder/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..69dec5b4dbfd --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/PsExtensions.cs b/src/ImageBuilder/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..bef7a175ed3d --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,160 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/PsHelpers.cs b/src/ImageBuilder/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..c88bdb58e768 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/StringExtensions.cs b/src/ImageBuilder/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..f7384796f05a --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/ImageBuilder/generated/runtime/BuildTime/XmlExtensions.cs b/src/ImageBuilder/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..9a6eec3845f8 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/ImageBuilder/generated/runtime/CmdInfoHandler.cs b/src/ImageBuilder/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..e4506d25aea1 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/ImageBuilder/generated/runtime/Conversions/ConversionException.cs b/src/ImageBuilder/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..e3ee8dc329ba --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/IJsonConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..13e783863aa9 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..5903dce8dddb --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..710827df4b48 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..79f2128abdad --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..00ec2e7ad42f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..4ccaa48af052 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..3028c0df086f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..c2b3814c5166 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..f103f99b6824 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..b01682ddeadb --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..e8d5220be5bd --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..99680bc5eff7 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..dc60fb184052 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..edd7b2ce0bc6 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..2dc47de1723b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..195250a9772f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/StringConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..0f93fb9263b6 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..3eb58eb9b297 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..30bbb0537927 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..0dccd0480181 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..fa94cf6cc55b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/Instances/UriConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..cbd4d96bd359 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/JsonConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..6351d7a90153 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/ImageBuilder/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..d24b900a8297 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/JsonConverterFactory.cs b/src/ImageBuilder/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..785258ed6891 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Conversions/StringLikeConverter.cs b/src/ImageBuilder/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..f1d0aefc74ab --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/IJsonSerializable.cs b/src/ImageBuilder/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..4734b3f28de1 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,249 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonArray.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..98766ef434a0 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonBoolean.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..7cb46c10cb7a --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonNode.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..434492e5ebf0 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonNumber.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..b7c08c825130 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonObject.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..4828d9cced4f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/JsonString.cs b/src/ImageBuilder/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..b00b2ca2d603 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Customizations/XNodeArray.cs b/src/ImageBuilder/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..b36eae12c11b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Debugging.cs b/src/ImageBuilder/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..48600b5c4d17 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/ImageBuilder/generated/runtime/DictionaryExtensions.cs b/src/ImageBuilder/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..3c8dc223ac40 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + if (value is System.Collections.Hashtable nested) + { + HashTableToDictionary(nested, new System.Collections.Generic.Dictionary()); + } + else + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/EventData.cs b/src/ImageBuilder/generated/runtime/EventData.cs new file mode 100644 index 000000000000..51ccb8a3db06 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/EventDataExtensions.cs b/src/ImageBuilder/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..366bef2a66fc --- /dev/null +++ b/src/ImageBuilder/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System; + + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/EventListener.cs b/src/ImageBuilder/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..49cf7127e305 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Events.cs b/src/ImageBuilder/generated/runtime/Events.cs new file mode 100644 index 000000000000..3d18bc07f600 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/EventsExtensions.cs b/src/ImageBuilder/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..8d99db9dc393 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Extensions.cs b/src/ImageBuilder/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..9d82e18301c4 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Extensions.cs @@ -0,0 +1,111 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System.Linq; + + internal static partial class Extensions + { + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => headerName == each.Key).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/ImageBuilder/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..2d5403e4d8f4 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/ImageBuilder/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..829f91d359db --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Helpers/Seperator.cs b/src/ImageBuilder/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..e80da1f11549 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Helpers/TypeDetails.cs b/src/ImageBuilder/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..7a5b3bd413d2 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Helpers/XHelper.cs b/src/ImageBuilder/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..e72c93f96fbc --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/HttpPipeline.cs b/src/ImageBuilder/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..553e90f3240a --- /dev/null +++ b/src/ImageBuilder/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/ImageBuilder/generated/runtime/HttpPipelineMocking.ps1 b/src/ImageBuilder/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..500707bfded0 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/ImageBuilder/generated/runtime/IAssociativeArray.cs b/src/ImageBuilder/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..6b75f17c46eb --- /dev/null +++ b/src/ImageBuilder/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + int Count { get; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/IHeaderSerializable.cs b/src/ImageBuilder/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..5be4968eee19 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/ISendAsync.cs b/src/ImageBuilder/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..6ede278690a8 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/ISendAsync.cs @@ -0,0 +1,289 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/InfoAttribute.cs b/src/ImageBuilder/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..c967372ffe7d --- /dev/null +++ b/src/ImageBuilder/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Iso/IsoDate.cs b/src/ImageBuilder/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..fb540bcd87dd --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/ImageBuilder/generated/runtime/JsonType.cs b/src/ImageBuilder/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..b44e3579da8f --- /dev/null +++ b/src/ImageBuilder/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Method.cs b/src/ImageBuilder/generated/runtime/Method.cs new file mode 100644 index 000000000000..6624f6caa467 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Models/JsonMember.cs b/src/ImageBuilder/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..155247cd4131 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Models/JsonModel.cs b/src/ImageBuilder/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..a9a0aa392c68 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Models/JsonModelCache.cs b/src/ImageBuilder/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..9c64c5278df6 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/Collections/JsonArray.cs b/src/ImageBuilder/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..3093c7a92eed --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/ImageBuilder/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..14f4628d9578 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/Collections/XList.cs b/src/ImageBuilder/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..73be810d1f79 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/ImageBuilder/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..19bdefc36114 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/Collections/XSet.cs b/src/ImageBuilder/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..e3babe343a8d --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonBoolean.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..4229490dda13 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonDate.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..5ed0e251201e --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonNode.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..49562e5a0696 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonNumber.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..507baf39f8ef --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonObject.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..888afdec7d01 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/JsonString.cs b/src/ImageBuilder/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..ce22976394da --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/XBinary.cs b/src/ImageBuilder/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..d73a0cad1cce --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Nodes/XNull.cs b/src/ImageBuilder/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..8d3b9a0ea8c0 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/Exceptions/ParseException.cs b/src/ImageBuilder/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..5f690a5a4563 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/JsonParser.cs b/src/ImageBuilder/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..9d61feba0051 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/JsonToken.cs b/src/ImageBuilder/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..023036c0ef6b --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/JsonTokenizer.cs b/src/ImageBuilder/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..e20d1f590948 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/Location.cs b/src/ImageBuilder/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..12607451cd91 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/Readers/SourceReader.cs b/src/ImageBuilder/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..1931daaf5ef4 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Parser/TokenReader.cs b/src/ImageBuilder/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..10148c3bfbaa --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/PipelineMocking.cs b/src/ImageBuilder/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..472e00d22342 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/PipelineMocking.cs @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result); + + internal static JsonNode SerializeContent(byte[] content) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (content.EndsWith("==")) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content) }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content) }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"))) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"))) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Response.cs b/src/ImageBuilder/generated/runtime/Response.cs new file mode 100644 index 000000000000..1ad53c954354 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Serialization/JsonSerializer.cs b/src/ImageBuilder/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..d6e300301b21 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Serialization/PropertyTransformation.cs b/src/ImageBuilder/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..a17db724513e --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Serialization/SerializationOptions.cs b/src/ImageBuilder/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..41f6bb3c8669 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/SerializationMode.cs b/src/ImageBuilder/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..dc2589e182d0 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/TypeConverterExtensions.cs b/src/ImageBuilder/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..07aa70a0c6cf --- /dev/null +++ b/src/ImageBuilder/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,190 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + } +} diff --git a/src/ImageBuilder/generated/runtime/UndeclaredResponseException.cs b/src/ImageBuilder/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..7874b6216ac7 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json.JsonObject; + + // see if there is an error block in the body + json = json.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // we'll create one below. + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/generated/runtime/Writers/JsonWriter.cs b/src/ImageBuilder/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..c0809731d2e2 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/ImageBuilder/generated/runtime/delegates.cs b/src/ImageBuilder/generated/runtime/delegates.cs new file mode 100644 index 000000000000..c06419005272 --- /dev/null +++ b/src/ImageBuilder/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/ImageBuilder/help/Az.ImageBuilder.md b/src/ImageBuilder/help/Az.ImageBuilder.md new file mode 100644 index 000000000000..dd936831cfe6 --- /dev/null +++ b/src/ImageBuilder/help/Az.ImageBuilder.md @@ -0,0 +1,40 @@ +--- +Module Name: Az.ImageBuilder +Module Guid: bdedc683-d9b6-41ea-b310-d068b8c72305 +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.ImageBuilder Module +## Description +Microsoft Azure PowerShell: ImageBuilder cmdlets + +## Az.ImageBuilder Cmdlets +### [Get-AzImageBuilderRunOutput](Get-AzImageBuilderRunOutput.md) +Get the specified run output for the specified image template resource + +### [Get-AzImageBuilderTemplate](Get-AzImageBuilderTemplate.md) +Get information about a virtual machine image template + +### [New-AzImageBuilderCustomizerObject](New-AzImageBuilderCustomizerObject.md) +Describes a unit of image customization + +### [New-AzImageBuilderDistributorObject](New-AzImageBuilderDistributorObject.md) +Generic distribution object + +### [New-AzImageBuilderSourceObject](New-AzImageBuilderSourceObject.md) +Describes a virtual machine image source for building, customizing and distributing. + +### [New-AzImageBuilderTemplate](New-AzImageBuilderTemplate.md) +Create a virtual machine image template + +### [Remove-AzImageBuilderTemplate](Remove-AzImageBuilderTemplate.md) +Delete a virtual machine image template + +### [Start-AzImageBuilderTemplate](Start-AzImageBuilderTemplate.md) +Create artifacts from a existing image template + +### [Stop-AzImageBuilderTemplate](Stop-AzImageBuilderTemplate.md) +Cancel the long running image build based on the image template + diff --git a/src/ImageBuilder/help/Get-AzImageBuilderRunOutput.md b/src/ImageBuilder/help/Get-AzImageBuilderRunOutput.md new file mode 100644 index 000000000000..79a65e67ab1d --- /dev/null +++ b/src/ImageBuilder/help/Get-AzImageBuilderRunOutput.md @@ -0,0 +1,194 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuilderrunoutput +schema: 2.0.0 +--- + +# Get-AzImageBuilderRunOutput + +## SYNOPSIS +Get the specified run output for the specified image template resource + +## SYNTAX + +### List (Default) +``` +Get-AzImageBuilderRunOutput -ImageTemplateName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzImageBuilderRunOutput -ImageTemplateName -ResourceGroupName -RunOutputName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzImageBuilderRunOutput -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the specified run output for the specified image template resource + +## EXAMPLES + +### Example 1: List all run results under a template +```powershell +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Name Type +---- ---- +image_lucas_1 Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` + +This command lists all run results under a template. + +### Example 2: Get a run result under a template +```powershell +PS C:\> Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` + +This command gets a run result under a template. + +### Example 3: Get a run result under a template +```powershell +PS C:\> $result = Get-AzImageBuilderRunOutput -ImageTemplateName template-name-u7gjqx -ResourceGroupName wyunchi-imagebuilder -RunOutputName runout-template-name-u7gjqx +PS C:\> Get-AzImageBuilderRunOutput -InputObject $result + +Name Type +---- ---- +runout-template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates/runOutputs +``` + +This command gets a run result under a template. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunOutputName +The name of the run output + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. +The subscription Id forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IRunOutput + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[ImageTemplateName ]`: The name of the image Template + - `[ResourceGroupName ]`: The name of the resource group. + - `[RunOutputName ]`: The name of the run output + - `[SubscriptionId ]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/Get-AzImageBuilderTemplate.md b/src/ImageBuilder/help/Get-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..09c7c5269a04 --- /dev/null +++ b/src/ImageBuilder/help/Get-AzImageBuilderTemplate.md @@ -0,0 +1,205 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azimagebuildertemplate +schema: 2.0.0 +--- + +# Get-AzImageBuilderTemplate + +## SYNOPSIS +Get information about a virtual machine image template + +## SYNTAX + +### List (Default) +``` +Get-AzImageBuilderTemplate [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzImageBuilderTemplate -ImageTemplateName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzImageBuilderTemplate -InputObject [-DefaultProfile ] + [] +``` + +### List1 +``` +Get-AzImageBuilderTemplate -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Get information about a virtual machine image template + +## EXAMPLES + +### Example 1: List all template under a subscription +```powershell +PS C:\> Get-AzImageBuilderTemplate + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +``` + +This command lists all template under a subscription. + +### Example 2: List all template under a resource group +```powershell +PS C:\> Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus HelloImageTemplateLinux01 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ax01b7 Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-klcuav Microsoft.VirtualMachineImages/imageTemplates +eastus template-name-u7gjqx Microsoft.VirtualMachineImages/imageTemplates +eastus test-imagebuilder Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-managedimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-platform-managed Microsoft.VirtualMachineImages/imageTemplates +eastus tmpl-shareimg-managedimg Microsoft.VirtualMachineImages/imageTemplates +``` + +This command lists all template under a resource group. + +### Example 3: Get a template under a resource group +```powershell +PS C:\> Get-AzImageBuilderTemplate -ImageTemplateName lucas-imagetemplate -ResourceGroupName wyunchi-imagebuilder + +Location Name Type +-------- ---- ---- +eastus lucas-imagetemplate Microsoft.VirtualMachineImages/imageTemplates +``` + +This command gets a template under a resource group. + +### Example 4: Get a template under a resource group +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -ImageTemplateName template-name-ep5z7v +PS C:\> Get-AzImageBuilderTemplate -InputObject $template + +Location Name Type +-------- ---- ---- +eastus template-name-ep5z7v Microsoft.VirtualMachineImages/imageTemplates +``` + +This command gets a template under a resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. +The subscription Id forms part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[ImageTemplateName ]`: The name of the image Template + - `[ResourceGroupName ]`: The name of the resource group. + - `[RunOutputName ]`: The name of the run output + - `[SubscriptionId ]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/New-AzImageBuilderCustomizerObject.md b/src/ImageBuilder/help/New-AzImageBuilderCustomizerObject.md new file mode 100644 index 000000000000..67c624efcf13 --- /dev/null +++ b/src/ImageBuilder/help/New-AzImageBuilderCustomizerObject.md @@ -0,0 +1,425 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderCustomizerObject +schema: 2.0.0 +--- + +# New-AzImageBuilderCustomizerObject + +## SYNOPSIS +Describes a unit of image customization + +## SYNTAX + +### ShellCustomizer (Default) +``` +New-AzImageBuilderCustomizerObject -CustomizerName -Sha256Checksum -ShellCustomizer + [-Inline ] [-ScriptUri ] [] +``` + +### FileCustomizer +``` +New-AzImageBuilderCustomizerObject -CustomizerName -FileCustomizer -Sha256Checksum + [-Destination ] [-SourceUri ] [] +``` + +### PowerShellCustomizer +``` +New-AzImageBuilderCustomizerObject -CustomizerName -PowerShellCustomizer -Sha256Checksum + [-Inline ] [-RunElevated ] [-ScriptUri ] [-ValidExitCode ] + [] +``` + +### RestartCustomizer +``` +New-AzImageBuilderCustomizerObject -CustomizerName -RestartCustomizer [-RestartCheckCommand ] + [-RestartCommand ] [-RestartTimeout ] [] +``` + +### WindowsUpdateCustomizer +``` +New-AzImageBuilderCustomizerObject -CustomizerName -WindowsUpdateCustomizer [-Filter ] + [-SearchCriterion ] [-UpdateLimit ] [] +``` + +## DESCRIPTION +Describes a unit of image customization + +## EXAMPLES + +### Example 1: Create a windows update customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter ("BrowseOnly", "IsInstalled") -SearchCriterion "BrowseOnly=0 and IsInstalled=0" -UpdateLimit 100 -CustomizerName 'WindUpdate' + +Name Type Filter SearchCriterion UpdateLimit +---- ---- ------ --------------- ----------- +WindUpdate WindowsUpdate {BrowseOnly, IsInstalled} BrowseOnly=0 and IsInstalled=0 100 +``` + +This command creates a windows update customizer. + +### Example 2: Create a file customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName 'filecus' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' -Destination 'c:\\buildArtifacts\\index.html' -SourceUri 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + +Name Type Destination Sha256Checksum SourceUri +---- ---- ----------- -------------- --------- +filecus File c:\\buildArtifacts\\index.html ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html + +``` + +This command creates a file customizer. + +### Example 3: Create a powershell customizer +```powershell +PS C:\> $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt") +PS C:\> New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName settingUpMgmtAgtPath -RunElevated $false -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 -Inline $inline + +Name Type Inline RunElevated ScriptUri Sha256Checksum ValidExitC e +---- ---- ------ ----------- --------- -------------- -- +settingUpMgmtAgtPath PowerShell {mkdir c:\\buildActions, echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt} False ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +``` + +This command creates a powershell customizer. + +### Example 4: Create a restart customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName 'restcus' -RestartCommand 'shutdown /f /r /t 0 /c \"packer restart\"' -RestartCheckCommand 'powershell -command "& {Write-Output "restarted."}"' -RestartTimeout '10m' + +Name Type RestartCheckCommand RestartCommand RestartTimeout +---- ---- ------------------- -------------- -------------- +restcus WindowsRestart powershell -command "& {Write-Output "restarted."}" shutdown /f /r /t 0 /c \"packer restart\" 10m +``` + +This command creates a restart customizer. + +### Example 5: Create a shell customizer +```powershell +PS C:\> New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName downloadBuildArtifacts -ScriptUri "https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh" -Sha256Checksum ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 + +Name Type Inline ScriptUri Sha256Checksum +---- ---- ------ --------- -------------- +downloadBuildArtifacts Shell https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93 +``` + +This command creates a shell customizer. + +## PARAMETERS + +### -CustomizerName +Friendly Name to provide context on what this customization step does. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Destination +The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM. + +```yaml +Type: System.String +Parameter Sets: FileCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FileCustomizer +Uploads files to VMs (Linux, Windows). +Corresponds to Packer file provisioner. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: FileCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +Array of filters to select updates to apply. +Omit or specify empty array to use the default (no filter). +Refer to above link for examples and detailed description of this field. + +```yaml +Type: System.String[] +Parameter Sets: WindowsUpdateCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Inline +Array of shell commands to execute. + +```yaml +Type: System.String[] +Parameter Sets: PowerShellCustomizer, ShellCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PowerShellCustomizer +Runs the specified PowerShell on the VM (Windows). +Corresponds to Packer powershell provisioner. +Exactly one of 'scriptUri' or 'inline' can be specified. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: PowerShellCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RestartCheckCommand +Command to check if restart succeeded [Default: '']. + +```yaml +Type: System.String +Parameter Sets: RestartCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RestartCommand +Command to execute the restart [Default: 'shutdown /r /f /t 0 /c packer restart'] + +```yaml +Type: System.String +Parameter Sets: RestartCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RestartCustomizer +Reboots a VM and waits for it to come back online (Windows). +Corresponds to Packer windows-restart provisioner. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: RestartCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RestartTimeout +Restart timeout specified as a string of magnitude and unit, e.g. +'5m' (5 minutes) or '2h' (2 hours) [Default: '5m']. + +```yaml +Type: System.String +Parameter Sets: RestartCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunElevated +If specified, the PowerShell script will be run with elevated privileges. + +```yaml +Type: System.Boolean +Parameter Sets: PowerShellCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ScriptUri +URI of the shell script to be run for customizing. +It can be a github link, SAS URI for Azure Storage, etc. + +```yaml +Type: System.String +Parameter Sets: PowerShellCustomizer, ShellCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SearchCriterion +Criteria to search updates. +Omit or specify empty string to use the default (search all). +Refer to above link for examples and detailed description of this field. + +```yaml +Type: System.String +Parameter Sets: WindowsUpdateCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sha256Checksum +SHA256 checksum of the shell script provided in the scriptUri field. + +```yaml +Type: System.String +Parameter Sets: FileCustomizer, PowerShellCustomizer, ShellCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShellCustomizer +Runs a shell script during the customization phase (Linux). +Corresponds to Packer shell provisioner. +Exactly one of 'scriptUri' or 'inline' can be specified. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ShellCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceUri +The URI of the file to be uploaded for customizing the VM. +It can be a github link, SAS URI for Azure Storage, etc. + +```yaml +Type: System.String +Parameter Sets: FileCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UpdateLimit +Maximum number of updates to apply at a time. +Omit or specify 0 to use the default (1000). + +```yaml +Type: System.Int32 +Parameter Sets: WindowsUpdateCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ValidExitCode +Valid exit codes for the PowerShell script. +[Default: 0]. + +```yaml +Type: System.Int32[] +Parameter Sets: PowerShellCustomizer +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WindowsUpdateCustomizer +Installs Windows Updates. +Corresponds to Packer Windows Update Provisioner (https://github.com/rgl/packer-provisioner-windows-update). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: WindowsUpdateCustomizer +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/New-AzImageBuilderDistributorObject.md b/src/ImageBuilder/help/New-AzImageBuilderDistributorObject.md new file mode 100644 index 000000000000..14bbca4fe658 --- /dev/null +++ b/src/ImageBuilder/help/New-AzImageBuilderDistributorObject.md @@ -0,0 +1,256 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-AzImageBuilderDistributorObject +schema: 2.0.0 +--- + +# New-AzImageBuilderDistributorObject + +## SYNOPSIS +Generic distribution object + +## SYNTAX + +### ManagedImageDistributor (Default) +``` +New-AzImageBuilderDistributorObject -ArtifactTag -ImageId -Location + -ManagedImageDistributor -RunOutputName [] +``` + +### SharedImageDistributor +``` +New-AzImageBuilderDistributorObject -ArtifactTag -ExcludeFromLatest + -GalleryImageId -ReplicationRegion -RunOutputName -SharedImageDistributor + [-StorageAccountType ] [] +``` + +### VhdDistributor +``` +New-AzImageBuilderDistributorObject -ArtifactTag -RunOutputName -VhdDistributor + [] +``` + +## DESCRIPTION +Generic distribution object + +## EXAMPLES + +### Example 1: Create a managed image distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare -RunOutputName luacas-runout -Location eastus + +RunOutputName Type ImageId Location +------------- ---- ------- -------- +luacas-runout ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imageshare eastus +``` + +This command creates a managed image distributor. + +### Example 2: Create a VHD distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -ArtifactTag @{tag='vhd'} -VhdDistributor -RunOutputName image-vhd + +RunOutputName Type +------------- ---- +image-vhd Vhd +``` + +This command creates a VHD distributor. + +### Example 3: Create a shared image distributor +```powershell +PS C:\> New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion eastus2 -RunOutputName 'outname' -ExcludeFromLatest $false + +RunOutputName Type ExcludeFromLatest GalleryImageId ReplicationRegi + on +------------- ---- ----------------- -------------- --------------- +outname SharedImage False /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share {eastus2} +``` + +This command creates a shared image distributor. + +## PARAMETERS + +### -ArtifactTag +Tags that will be applied to the artifact once it has been created/updated by the distributor. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExcludeFromLatest +Flag that indicates whether created image version should be excluded from latest. +Omit to use the default (false). + +```yaml +Type: System.Boolean +Parameter Sets: SharedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -GalleryImageId +Resource Id of the Shared Image Gallery image. + +```yaml +Type: System.String +Parameter Sets: SharedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageId +Resource Id of the Managed Disk Image. + +```yaml +Type: System.String +Parameter Sets: ManagedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Azure location for the image, should match if image already exists. + +```yaml +Type: System.String +Parameter Sets: ManagedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ManagedImageDistributor +Distribute as a Managed Disk Image. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ManagedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReplicationRegion +A list of regions that the image will be replicated to. + +```yaml +Type: System.String[] +Parameter Sets: SharedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -RunOutputName +The name to be used for the associated RunOutput. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SharedImageDistributor +Distribute via Shared Image Gallery. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: SharedImageDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageAccountType +Storage account type to be used to store the shared image. +Omit to use the default (Standard_LRS). + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.SharedImageStorageAccountType +Parameter Sets: SharedImageDistributor +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VhdDistributor +Distribute via VHD in a storage account. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: VhdDistributor +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/New-AzImageBuilderSourceObject.md b/src/ImageBuilder/help/New-AzImageBuilderSourceObject.md new file mode 100644 index 000000000000..60c5e14ca8c7 --- /dev/null +++ b/src/ImageBuilder/help/New-AzImageBuilderSourceObject.md @@ -0,0 +1,273 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderSourceObject +schema: 2.0.0 +--- + +# New-AzImageBuilderSourceObject + +## SYNOPSIS +Describes a virtual machine image source for building, customizing and distributing. + +## SYNTAX + +### ManagedImage (Default) +``` +New-AzImageBuilderSourceObject -SourceTypeManagedImage [-ImageId ] [] +``` + +### PlatformImage +``` +New-AzImageBuilderSourceObject -SourceTypePlatformImage [-Offer ] [-Publisher ] + [-Sku ] [-Version ] [] +``` + +### PlatformImagePlanInfo +``` +New-AzImageBuilderSourceObject -PlanName -PlanProduct -PlanPublisher + -SourceTypePlatformImage [-Offer ] [-Publisher ] [-Sku ] [-Version ] + [] +``` + +### SharedImageVersion +``` +New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion [-ImageVersionId ] [] +``` + +## DESCRIPTION +Describes a virtual machine image source for building, customizing and distributing. + +## EXAMPLES + +### Example 1: Create a managed image source +```powershell +PS C:\> $imageid = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image' +PS C:\> New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageid + +Type ImageId +---- ------- +ManagedImage /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image +``` + +This command creates a managed image source. + +### Example 2: Create a shared image source +```powershell +PS C:\> New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 + +Type ImageVersionId +---- -------------- +SharedImageVersion /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0 +``` + +This command creates a shared image source. + +### Example 3: Create a platfrom image source +```powershell +PS C:\> New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' + +Type Offer Publisher Sku Version +---- ----- --------- --- ------- +PlatformImage UbuntuServer Canonical 18.04-LTS latest +``` + +This command creates a platfrom image source. + +## PARAMETERS + +### -ImageId +ARM resource id of the managed image in customer subscription. + +```yaml +Type: System.String +Parameter Sets: ManagedImage +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageVersionId +ARM resource id of the image version in the shared image gallery. + +```yaml +Type: System.String +Parameter Sets: SharedImageVersion +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Offer +Image offer from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + +```yaml +Type: System.String +Parameter Sets: PlatformImage, PlatformImagePlanInfo +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PlanName +Name of the purchase plan. + +```yaml +Type: System.String +Parameter Sets: PlatformImagePlanInfo +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PlanProduct +Product of the purchase plan. + +```yaml +Type: System.String +Parameter Sets: PlatformImagePlanInfo +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PlanPublisher +Publisher of the purchase plan. + +```yaml +Type: System.String +Parameter Sets: PlatformImagePlanInfo +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Publisher +Image Publisher in [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + +```yaml +Type: System.String +Parameter Sets: PlatformImage, PlatformImagePlanInfo +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +Image sku from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + +```yaml +Type: System.String +Parameter Sets: PlatformImage, PlatformImagePlanInfo +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceTypeManagedImage +Describes an image source that is a managed image in customer subscription. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: ManagedImage +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceTypePlatformImage +Describes an image source from [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: PlatformImage, PlatformImagePlanInfo +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SourceTypeSharedImageVersion +Describes an image source that is an image version in a shared image gallery. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: SharedImageVersion +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Version +Image version from the [Azure Gallery Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + +```yaml +Type: System.String +Parameter Sets: PlatformImage, PlatformImagePlanInfo +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/New-AzImageBuilderTemplate.md b/src/ImageBuilder/help/New-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..5d4ed1a3abb9 --- /dev/null +++ b/src/ImageBuilder/help/New-AzImageBuilderTemplate.md @@ -0,0 +1,467 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/New-AzImageBuilderTemplate +schema: 2.0.0 +--- + +# New-AzImageBuilderTemplate + +## SYNOPSIS +Create a virtual machine image template + +## SYNTAX + +``` +New-AzImageBuilderTemplate -ImageTemplateName -ResourceGroupName + -Distribute -Source -UserAssignedIdentityId + [-SubscriptionId ] [-BuildTimeoutInMinute ] [-Customize ] + [-LastRunStatusEndTime ] [-LastRunStatusMessage ] [-LastRunStatusRunState ] + [-LastRunStatusRunSubState ] [-LastRunStatusStartTime ] [-Location ] + [-ProvisioningErrorCode ] [-ProvisioningErrorMessage ] [-Tag ] + [-VMProfileOsdiskSizeInGb ] [-VMProfileVmSize ] [-VnetConfigSubnetId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create a virtual machine image template + +## EXAMPLES + +### Example 1: Create a virtual machine image template +```powershell +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan +``` + +This commands creates a virtual machine image template. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BuildTimeoutInMinute +Maximum duration to wait while building the image template. +Omit or specify 0 to use the default (4 hours). + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Customize +Specifies the properties used to describe the customization steps of the image, like Image source etc. +To construct, see NOTES section for CUSTOMIZE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateCustomizer[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +region HideParameter + The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Distribute +The distribution targets where the image output needs to go to. +To construct, see NOTES section for DISTRIBUTE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateDistributor[] +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastRunStatusEndTime +End time of the last run (UTC). + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastRunStatusMessage +Verbose information about the last run state. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastRunStatusRunState +State of the last run. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunState +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastRunStatusRunSubState +Sub-state of the last run. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.RunSubState +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LastRunStatusStartTime +Start time of the last run (UTC). + +```yaml +Type: System.DateTime +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Resource location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisioningErrorCode +Error code of the provisioning failure. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Support.ProvisioningErrorCode +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisioningErrorMessage +Verbose error message about the provisioning failure. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Source +Describes a virtual machine image source for building, customizing and distributing. +To construct, see NOTES section for SOURCE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplateSource +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Resource tags. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -UserAssignedIdentityId +The id of user assigned identity. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMProfileOsdiskSizeInGb +Size of the OS disk in GB. +Omit or specify 0 to use Azure's default OS disk size. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VMProfileVmSize +Size of the virtual machine used to build, customize and capture images. +Omit or specify empty string to use the default (Standard_D1_v2). + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VnetConfigSubnetId +Resource id of a pre-existing subnet. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +CUSTOMIZE : Specifies the properties used to describe the customization steps of the image, like Image source etc. + - `Type `: The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + - `[Name ]`: Friendly Name to provide context on what this customization step does + +DISTRIBUTE : The distribution targets where the image output needs to go to. + - `RunOutputName `: The name to be used for the associated RunOutput. + - `Type `: Type of distribution. + - `[ArtifactTag ]`: Tags that will be applied to the artifact once it has been created/updated by the distributor. + - `[(Any) ]`: This indicates any property can be added to this object. + +SOURCE : Describes a virtual machine image source for building, customizing and distributing. + - `Type `: Specifies the type of source image you want to start with. + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/Remove-AzImageBuilderTemplate.md b/src/ImageBuilder/help/Remove-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..44698f223d25 --- /dev/null +++ b/src/ImageBuilder/help/Remove-AzImageBuilderTemplate.md @@ -0,0 +1,233 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/remove-azimagebuildertemplate +schema: 2.0.0 +--- + +# Remove-AzImageBuilderTemplate + +## SYNOPSIS +Delete a virtual machine image template + +## SYNTAX + +### Delete (Default) +``` +Remove-AzImageBuilderTemplate -ImageTemplateName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzImageBuilderTemplate -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete a virtual machine image template + +## EXAMPLES + +### Example 1: Remove a image template +```powershell +PS C:\> Remove-AzImageBuilderTemplate -ImageTemplateName template-name-dmt6ze -ResourceGroupName wyunchi-imagebuilder + +``` + +This command removes a image template. + +### Example 2: Remove a image template +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ImageTemplateName template-name-3uo8p6 -ResourceGroupName wyunchi-imagebuilder +PS C:\> Remove-AzImageBuilderTemplate -InputObject $template + +``` + +This command removes a image template. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. +The subscription Id forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[ImageTemplateName ]`: The name of the image Template + - `[ResourceGroupName ]`: The name of the resource group. + - `[RunOutputName ]`: The name of the run output + - `[SubscriptionId ]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/Start-AzImageBuilderTemplate.md b/src/ImageBuilder/help/Start-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..0931b6010e80 --- /dev/null +++ b/src/ImageBuilder/help/Start-AzImageBuilderTemplate.md @@ -0,0 +1,233 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/start-azimagebuildertemplate +schema: 2.0.0 +--- + +# Start-AzImageBuilderTemplate + +## SYNOPSIS +Create artifacts from a existing image template + +## SYNTAX + +### Run (Default) +``` +Start-AzImageBuilderTemplate -ImageTemplateName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### RunViaIdentity +``` +Start-AzImageBuilderTemplate -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create artifacts from a existing image template + +## EXAMPLES + +### Example 1: Start an image template +```powershell +PS C:\> Start-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg + +``` + +This command starts an image template. + +### Example 2: Start an image template +```powershell +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Start-AzImageBuilderTemplate -InputObject $template + +``` + +This command starts an image template. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template + +```yaml +Type: System.String +Parameter Sets: Run +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +Parameter Sets: RunViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Run +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. +The subscription Id forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Run +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[ImageTemplateName ]`: The name of the image Template + - `[ResourceGroupName ]`: The name of the resource group. + - `[RunOutputName ]`: The name of the run output + - `[SubscriptionId ]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/ImageBuilder/help/Stop-AzImageBuilderTemplate.md b/src/ImageBuilder/help/Stop-AzImageBuilderTemplate.md new file mode 100644 index 000000000000..536b191901f3 --- /dev/null +++ b/src/ImageBuilder/help/Stop-AzImageBuilderTemplate.md @@ -0,0 +1,244 @@ +--- +external help file: +Module Name: Az.ImageBuilder +online version: https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/stop-azimagebuildertemplate +schema: 2.0.0 +--- + +# Stop-AzImageBuilderTemplate + +## SYNOPSIS +Cancel the long running image build based on the image template + +## SYNTAX + +### Cancel (Default) +``` +Stop-AzImageBuilderTemplate -ImageTemplateName -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### CancelViaIdentity +``` +Stop-AzImageBuilderTemplate -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Cancel the long running image build based on the image template + +## EXAMPLES + +### Example 1: Stop image template creation +```powershell +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +1 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> Stop-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder + +``` + +This command stops image template creation. + +### Example 2: Stop image template creation +```powershell +PS C:\> Start-AzImageBuilderTemplate -ImageTemplateName template-name-sn78hg -ResourceGroupName wyunchi-imagebuilder -AsJob + +Id Name PSJobTypeName State HasMoreData Location Command +-- ---- ------------- ----- ----------- -------- ------- +2 Start-AzImageB… Running True localhost Start-AzImageBuilderTemp… + +PS C:\> $template = Get-AzImageBuilderTemplate -ResourceGroupName wyunchi-imagebuilder -Name template-name-sn78hg +PS C:\> Stop-AzImageBuilderTemplate -InputObject $template + +``` + +This command stops image template creation. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ImageTemplateName +The name of the image Template + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: Name + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +Parameter Sets: CancelViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Subscription credentials which uniquely identify Microsoft Azure subscription. +The subscription Id forms part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Cancel +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[ImageTemplateName ]`: The name of the image Template + - `[ResourceGroupName ]`: The name of the resource group. + - `[RunOutputName ]`: The name of the run output + - `[SubscriptionId ]`: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +## RELATED LINKS + diff --git a/src/ImageBuilder/how-to.md b/src/ImageBuilder/how-to.md new file mode 100644 index 000000000000..08ad03631da8 --- /dev/null +++ b/src/ImageBuilder/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.ImageBuilder`. + +## Building `Az.ImageBuilder` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. + +## Testing `Az.ImageBuilder` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. + +## Packing `Az.ImageBuilder` +To pack `Az.ImageBuilder` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.ImageBuilder`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.ImageBuilder.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.ImageBuilder.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.ImageBuilder`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.ImageBuilder` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/ImageBuilder/internal/Az.ImageBuilder.internal.psm1 b/src/ImageBuilder/internal/Az.ImageBuilder.internal.psm1 new file mode 100644 index 000000000000..5d81f81428fb --- /dev/null +++ b/src/ImageBuilder/internal/Az.ImageBuilder.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ImageBuilder.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/ImageBuilder/internal/Get-AzOperation.ps1 b/src/ImageBuilder/internal/Get-AzOperation.ps1 new file mode 100644 index 000000000000..4ca741574637 --- /dev/null +++ b/src/ImageBuilder/internal/Get-AzOperation.ps1 @@ -0,0 +1,121 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists available operations for the Microsoft.VirtualMachineImages provider +.Description +Lists available operations for the Microsoft.VirtualMachineImages provider +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azoperation +#> +function Get-AzOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImageBuilder.private\Get-AzOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/internal/New-AzImageBuilderTemplate.ps1 b/src/ImageBuilder/internal/New-AzImageBuilderTemplate.ps1 new file mode 100644 index 000000000000..f3478a2366f2 --- /dev/null +++ b/src/ImageBuilder/internal/New-AzImageBuilderTemplate.ps1 @@ -0,0 +1,244 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update a virtual machine image template +.Description +Create or update a virtual machine image template +.Example +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +PARAMETER : Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + Location : Resource location + Distribute : The distribution targets where the image output needs to go to. + RunOutputName : The name to be used for the associated RunOutput. + Type : Type of distribution. + ImageId : Resource Id of the Managed Disk Image + Location : Azure location for the image, should match if image already exists + GalleryImageId : Resource Id of the Shared Image Gallery image + ReplicationRegion : A list of regions that the image will be replicated to + [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor. + [(Any) ]: This indicates any property can be added to this object. + [ExcludeFromLatest ]: Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + [StorageAccountType ]: Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). + SourceType : Specifies the type of source image you want to start with. + [Tag ]: Resource tags + [(Any) ]: This indicates any property can be added to this object. + [BuildTimeoutInMinute ]: Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + [Customize ]: Specifies the properties used to describe the customization steps of the image, like Image source etc + Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + [Name ]: Friendly Name to provide context on what this customization step does + [Inline ]: Array of shell commands to execute + [ScriptUri ]: URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + [Sha256Checksum ]: SHA256 checksum of the shell script provided in the scriptUri field + [RestartCheckCommand ]: Command to check if restart succeeded [Default: ''] + [RestartCommand ]: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + [RestartTimeout ]: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + [Filter ]: Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field. + [SearchCriterion ]: Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field. + [UpdateLimit ]: Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + [Inline ]: Array of PowerShell commands to execute + [RunElevated ]: If specified, the PowerShell script will be run with elevated privileges + [ScriptUri ]: URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + [Sha256Checksum ]: SHA256 checksum of the power shell script provided in the scriptUri field above + [ValidExitCode ]: Valid exit codes for the PowerShell script. [Default: 0] + [Destination ]: The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM + [Sha256Checksum ]: SHA256 checksum of the file provided in the sourceUri field above + [SourceUri ]: The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + [IdentityType ]: The type of identity used for the image template. The type 'None' will remove any identities from the image template. + [IdentityUserAssignedIdentity ]: The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + [(Any) ]: This indicates any property can be added to this object. + [LastRunStatusEndTime ]: End time of the last run (UTC) + [LastRunStatusMessage ]: Verbose information about the last run state + [LastRunStatusRunState ]: State of the last run + [LastRunStatusRunSubState ]: Sub-state of the last run + [LastRunStatusStartTime ]: Start time of the last run (UTC) + [ProvisioningErrorCode ]: Error code of the provisioning failure + [ProvisioningErrorMessage ]: Verbose error message about the provisioning failure + [VMProfileOsdiskSizeGb ]: Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + [VMProfileVmsize ]: Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2). + [VnetConfigSubnetId ]: Resource id of a pre-existing subnet. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-azimagebuildertemplate +#> +function New-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate] + # Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + # To construct, see NOTES section for PARAMETER properties and create a hash table. + ${Parameter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Create = 'Az.ImageBuilder.private\New-AzImageBuilderTemplate_Create'; + CreateViaIdentity = 'Az.ImageBuilder.private\New-AzImageBuilderTemplate_CreateViaIdentity'; + } + if (('Create') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/internal/ProxyCmdletDefinitions.ps1 b/src/ImageBuilder/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..c2ba2dc5721b --- /dev/null +++ b/src/ImageBuilder/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,365 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists available operations for the Microsoft.VirtualMachineImages provider +.Description +Lists available operations for the Microsoft.VirtualMachineImages provider +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/get-azoperation +#> +function Get-AzOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImageBuilder.private\Get-AzOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update a virtual machine image template +.Description +Create or update a virtual machine image template +.Example +PS C:\> $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' +PS C:\> $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0' -ReplicationRegion 'eastus2' -RunOutputName 'runoutput-01' -ExcludeFromLatest $false +PS C:\> $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName 'CheckSumCompareShellScript' -ScriptUri 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' -Sha256Checksum 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' +PS C:\> $userAssignedIdentity = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity' +PS C:\> New-AzImageBuilderTemplate -ImageTemplateName platform-shared-img -ResourceGroupName wyunchi-imagebuilder -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location eastus -UserAssignedIdentityId $userAssignedIdentity + +Location Name Type +-------- ---- ---- +PlanInfoPlanName : +PlanInfoPlanPublisher : +Sku : 18.04-LTS +Version : latest +PlanInfo : Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.PlatformImagePurchasePlan + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [ImageTemplateName ]: The name of the image Template + [ResourceGroupName ]: The name of the resource group. + [RunOutputName ]: The name of the run output + [SubscriptionId ]: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call. + +PARAMETER : Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + Location : Resource location + Distribute : The distribution targets where the image output needs to go to. + RunOutputName : The name to be used for the associated RunOutput. + Type : Type of distribution. + ImageId : Resource Id of the Managed Disk Image + Location : Azure location for the image, should match if image already exists + GalleryImageId : Resource Id of the Shared Image Gallery image + ReplicationRegion : A list of regions that the image will be replicated to + [ArtifactTag ]: Tags that will be applied to the artifact once it has been created/updated by the distributor. + [(Any) ]: This indicates any property can be added to this object. + [ExcludeFromLatest ]: Flag that indicates whether created image version should be excluded from latest. Omit to use the default (false). + [StorageAccountType ]: Storage account type to be used to store the shared image. Omit to use the default (Standard_LRS). + SourceType : Specifies the type of source image you want to start with. + [Tag ]: Resource tags + [(Any) ]: This indicates any property can be added to this object. + [BuildTimeoutInMinute ]: Maximum duration to wait while building the image template. Omit or specify 0 to use the default (4 hours). + [Customize ]: Specifies the properties used to describe the customization steps of the image, like Image source etc + Type : The type of customization tool you want to use on the Image. For example, "Shell" can be shell customizer + [Name ]: Friendly Name to provide context on what this customization step does + [Inline ]: Array of shell commands to execute + [ScriptUri ]: URI of the shell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + [Sha256Checksum ]: SHA256 checksum of the shell script provided in the scriptUri field + [RestartCheckCommand ]: Command to check if restart succeeded [Default: ''] + [RestartCommand ]: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer restart"'] + [RestartTimeout ]: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 minutes) or '2h' (2 hours) [Default: '5m'] + [Filter ]: Array of filters to select updates to apply. Omit or specify empty array to use the default (no filter). Refer to above link for examples and detailed description of this field. + [SearchCriterion ]: Criteria to search updates. Omit or specify empty string to use the default (search all). Refer to above link for examples and detailed description of this field. + [UpdateLimit ]: Maximum number of updates to apply at a time. Omit or specify 0 to use the default (1000) + [Inline ]: Array of PowerShell commands to execute + [RunElevated ]: If specified, the PowerShell script will be run with elevated privileges + [ScriptUri ]: URI of the PowerShell script to be run for customizing. It can be a github link, SAS URI for Azure Storage, etc + [Sha256Checksum ]: SHA256 checksum of the power shell script provided in the scriptUri field above + [ValidExitCode ]: Valid exit codes for the PowerShell script. [Default: 0] + [Destination ]: The absolute path to a file (with nested directory structures already created) where the file (from sourceUri) will be uploaded to in the VM + [Sha256Checksum ]: SHA256 checksum of the file provided in the sourceUri field above + [SourceUri ]: The URI of the file to be uploaded for customizing the VM. It can be a github link, SAS URI for Azure Storage, etc + [IdentityType ]: The type of identity used for the image template. The type 'None' will remove any identities from the image template. + [IdentityUserAssignedIdentity ]: The list of user identities associated with the image template. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + [(Any) ]: This indicates any property can be added to this object. + [LastRunStatusEndTime ]: End time of the last run (UTC) + [LastRunStatusMessage ]: Verbose information about the last run state + [LastRunStatusRunState ]: State of the last run + [LastRunStatusRunSubState ]: Sub-state of the last run + [LastRunStatusStartTime ]: Start time of the last run (UTC) + [ProvisioningErrorCode ]: Error code of the provisioning failure + [ProvisioningErrorMessage ]: Verbose error message about the provisioning failure + [VMProfileOsdiskSizeGb ]: Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + [VMProfileVmsize ]: Size of the virtual machine used to build, customize and capture images. Omit or specify empty string to use the default (Standard_D1_v2). + [VnetConfigSubnetId ]: Resource id of a pre-existing subnet. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.imagebuilder/new-azimagebuildertemplate +#> +function New-AzImageBuilderTemplate { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate])] +[CmdletBinding(DefaultParameterSetName='CreateViaIdentity', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Create', Mandatory)] + [Alias('Name')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the image Template + ${ImageTemplateName}, + + [Parameter(ParameterSetName='Create', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [System.String] + # The name of the resource group. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Create')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Subscription credentials which uniquely identify Microsoft Azure subscription. + # The subscription Id forms part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='CreateViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.IImageBuilderIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Models.Api20200214.IImageTemplate] + # Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider + # To construct, see NOTES section for PARAMETER properties and create a hash table. + ${Parameter}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImageBuilder.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Create = 'Az.ImageBuilder.private\New-AzImageBuilderTemplate_Create'; + CreateViaIdentity = 'Az.ImageBuilder.private\New-AzImageBuilderTemplate_CreateViaIdentity'; + } + if (('Create') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImageBuilder/internal/readme.md b/src/ImageBuilder/internal/readme.md new file mode 100644 index 000000000000..afcfc29a7b72 --- /dev/null +++ b/src/ImageBuilder/internal/readme.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.ImageBuilder.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.ImageBuilder`. Instead, this sub-module is imported by the `..\custom\Az.ImageBuilder.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.ImageBuilder.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.ImageBuilder`. \ No newline at end of file diff --git a/src/ImageBuilder/pack-module.ps1 b/src/ImageBuilder/pack-module.ps1 new file mode 100644 index 000000000000..c22fad33d87b --- /dev/null +++ b/src/ImageBuilder/pack-module.ps1 @@ -0,0 +1,16 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImageBuilder/readme.md b/src/ImageBuilder/readme.md new file mode 100644 index 000000000000..3f2978e26579 --- /dev/null +++ b/src/ImageBuilder/readme.md @@ -0,0 +1,118 @@ + +# Az.ImageBuilder +This directory contains the PowerShell module for the ImageBuilder service. + +--- +## Status +[![Az.ImageBuilder](https://img.shields.io/powershellgallery/v/Az.ImageBuilder.svg?style=flat-square&label=Az.ImageBuilder "Az.ImageBuilder")](https://www.powershellgallery.com/packages/Az.ImageBuilder/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.7.4 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.ImageBuilder`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2020-02-14/imagebuilder.json + +title: ImageBuilder +module-version: 0.1.0 +subject-prefix: '' + +identity-correction-for-post: true + +directive: + - where: + verb: Set|Update + subject: VirtualMachineImageTemplate + remove: true + - where: + subject: VirtualMachineImageTemplateRunOutput + set: + subject: ImageBuilderRunOutput + - where: + subject: VirtualMachineImageTemplate + set: + subject: ImageBuilderTemplate + - where: + verb: New + subject: ImageBuilderTemplate + hide: true + - where: + subject: ImageBuilderTemplate + parameter-name: ImageTemplateName + set: + alias: Name + # - where: + # variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$ + # remove: true + - where: + variant: ^CreateExpanded$|^CreateViaIdentityExpanded$ + remove: true + - from: source-file-csharp + where: $ + transform: $ = $.replace(/internal partial interface/, 'public partial interface'); + - from: source-file-csharp + where: $ + transform: $ = $.replace(/\).Match\(viaIdentity\)/g, ', global::System.Text.RegularExpressions.RegexOptions.IgnoreCase\).Match\(viaIdentity\)'); + - from: source-file-csharp + where: $ + transform: $ = $.replace(/Azure-AsyncOperation/g, 'azure-asyncoperation'); + - from: swagger-document + where: $.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run"].post.responses + transform: >- + return { + "200": { + "description": "The operation was successful." + }, + "204": { + "description": "The operation was successful." + }, + "202": { + "description": "The operation will be completed asynchronously." + }, + "default": { + "description": "Error response describing why the operation failed.", + "schema": { + "$ref": "#/definitions/ApiError" + } + } + } +``` diff --git a/src/ImageBuilder/run-module.ps1 b/src/ImageBuilder/run-module.ps1 new file mode 100644 index 000000000000..68e065f303f4 --- /dev/null +++ b/src/ImageBuilder/run-module.ps1 @@ -0,0 +1,59 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImageBuilder.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/ImageBuilder/test-module.ps1 b/src/ImageBuilder/test-module.ps1 new file mode 100644 index 000000000000..297ef5799df9 --- /dev/null +++ b/src/ImageBuilder/test-module.ps1 @@ -0,0 +1,68 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) { + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImageBuilder.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +if($Live) { + $TestMode = 'live' +} +if($Record) { + $TestMode = 'record' +} +try { + if ($TestMode -ne 'playback') { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + Invoke-Pester -Script @{ Path = $testFolder } -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") +} +Finally +{ + if ($TestMode -ne 'playback') { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImageBuilder/test/Az.ImageBuilder-TestResults.xml b/src/ImageBuilder/test/Az.ImageBuilder-TestResults.xml new file mode 100644 index 000000000000..854d41bed863 --- /dev/null +++ b/src/ImageBuilder/test/Az.ImageBuilder-TestResults.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Recording.json b/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Recording.json new file mode 100644 index 000000000000..0c057ff465b4 --- /dev/null +++ b/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzImageBuilderRunOutput+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "585d5163-0ff5-418d-b40e-0e30a02f63ee" ], + "CommandName": [ "Get-AzImageBuilderRunOutput" ], + "FullCommandName": [ "Get-AzImageBuilderRunOutput_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "x-ms-correlation-request-id": [ "dece4f2d-eb3d-4d86-8a70-db3f7c51eeee" ], + "x-ms-request-id": [ "9e09c444-7433-42e1-ac7b-e89dcdea5504" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055558Z:dece4f2d-eb3d-4d86-8a70-db3f7c51eeee" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:55:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "413" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"provisioningState\": \"Failed\"\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul\",\n \"name\": \"runout-template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates/runOutputs\"\n }\n ]\n}" + } + }, + "Get-AzImageBuilderRunOutput+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "1532b1a8-5ddd-4c3f-a55f-f541147e42da" ], + "CommandName": [ "Get-AzImageBuilderRunOutput" ], + "FullCommandName": [ "Get-AzImageBuilderRunOutput_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11973" ], + "x-ms-correlation-request-id": [ "02fb79ac-5340-4918-9f93-8cb4754c6e04" ], + "x-ms-request-id": [ "d88c28bc-cc99-4598-be72-730c2ce4b382" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055559Z:02fb79ac-5340-4918-9f93-8cb4754c6e04" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:55:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "378" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"provisioningState\": \"Failed\"\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul\",\n \"name\": \"runout-template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates/runOutputs\"\n}" + } + }, + "Get-AzImageBuilderRunOutput+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "24da27fb-eeb6-4c00-92d9-2b5a195ffcab" ], + "CommandName": [ "Get-AzImageBuilderRunOutput" ], + "FullCommandName": [ "Get-AzImageBuilderRunOutput_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11972" ], + "x-ms-correlation-request-id": [ "a8038045-de64-4483-bc13-d52414aa18c0" ], + "x-ms-request-id": [ "a899da64-cb28-4340-888b-2967fa0234da" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055559Z:a8038045-de64-4483-bc13-d52414aa18c0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:55:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "378" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"provisioningState\": \"Failed\"\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul\",\n \"name\": \"runout-template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates/runOutputs\"\n}" + } + }, + "Get-AzImageBuilderRunOutput+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "828bf114-53a5-4d7a-bd7c-ba0604d50827" ], + "CommandName": [ "Get-AzImageBuilderRunOutput" ], + "FullCommandName": [ "Get-AzImageBuilderRunOutput_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11971" ], + "x-ms-correlation-request-id": [ "f25cfdae-a37c-4ca9-bdd4-caf8e644c361" ], + "x-ms-request-id": [ "72113cdb-fd3b-4bc9-9d85-2a875b3839ed" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055600Z:f25cfdae-a37c-4ca9-bdd4-caf8e644c361" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:55:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "378" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"provisioningState\": \"Failed\"\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/runOutputs/runout-template-name-kmprul\",\n \"name\": \"runout-template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates/runOutputs\"\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Tests.ps1 b/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Tests.ps1 new file mode 100644 index 000000000000..cc1c1ce469b1 --- /dev/null +++ b/src/ImageBuilder/test/Get-AzImageBuilderRunOutput.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzImageBuilderRunOutput.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzImageBuilderRunOutput' { + It 'List' { + $resultsList = Get-AzImageBuilderRunOutput -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $resultsList.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $result = Get-AzImageBuilderRunOutput -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup -RunOutputName $env.Resources.RunOutputName.runOutputName20 + $result.Name | Should -Be $env.Resources.RunOutputName.runOutputName20 + } + + It 'GetViaIdentity' { + $object = Get-AzImageBuilderRunOutput -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup -RunOutputName $env.Resources.RunOutputName.runOutputName20 + $result = Get-AzImageBuilderRunOutput -InputObject $object + $result.Name | Should -Be $env.Resources.RunOutputName.runOutputName20 + } +} diff --git a/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Recording.json b/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Recording.json new file mode 100644 index 000000000000..04d4d31e8ff9 --- /dev/null +++ b/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Recording.json @@ -0,0 +1,275 @@ +{ + "Get-AzImageBuilderTemplate+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "2c1ec03e-fe0a-41ad-ae83-96592d9fbf76" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055601Z:b818b64b-f42b-4c50-87bd-c0f90127d95f" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11970" ], + "x-ms-correlation-request-id": [ "b818b64b-f42b-4c50-87bd-c0f90127d95f" ], + "x-ms-request-id": [ "d5124da0-8ef3-434c-923d-97accc53f1f1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19933" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"customize\": [\n {\n \"name\": \"RunScriptFromSource\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript.sh\",\n \"sha256Checksum\": \"2c6ff6902a4a52deee69e8db26d0036a53388651008aaf31795bb20dabd21fd8\",\n \"type\": \"Shell\"\n },\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n },\n {\n \"destination\": \"/tmp/index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"d9715d72889fb1a0463d06ce9e89d1d2bd33b2c5e5362a736db6f5a25e601a58\",\n \"sourceUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n },\n {\n \"inline\": [\n \"sudo mkdir /buildArtifacts\",\n \"sudo cp /tmp/index.html /buildArtifacts/index.html\"\n ],\n \"name\": \"setupBuildPath\",\n \"type\": \"Shell\"\n },\n {\n \"inline\": [\n \"sudo apt install unattended-upgrades\"\n ],\n \"name\": \"InstallUpgrades\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseosimg\": \"ubuntu1804\",\n \"source\": \"azVmImageBuilder\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"location\": \"eastus\",\n \"runOutputName\": \"test-linux-image-run-output\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-28T07:50:02.65707297Z\",\n \"endTime\": \"2020-04-28T07:59:56.925799187Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 80,\n \"vmProfile\": {\n \"vmSize\": \"Standard_D1_v2\",\n \"osDiskSizeGB\": 30\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/HelloImageTemplateLinux01\",\n \"name\": \"HelloImageTemplateLinux01\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {\n \"imagebuilderTemplate\": \"ubuntu1804\"\n }\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate\",\n \"name\": \"lucas-imagetemplate\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest-user-assign\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate-user-assign\",\n \"name\": \"lucas-imagetemplate-user-assign\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-shared-img\",\n \"name\": \"managed-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image\",\n \"name\": \"managed-vhd-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image-0\",\n \"name\": \"managed-vhd-image-0\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image02\",\n \"name\": \"managed-vhd-image02\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/image-test\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-01\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-managed-image\",\n \"name\": \"platform-managed-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runoutput-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-shared-img\",\n \"name\": \"platform-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-0jhwg4\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-0jhwg4\",\n \"name\": \"template-name-0jhwg4\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=10\"\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "30", "31" ], + "x-ms-client-request-id": [ "2c1ec03e-fe0a-41ad-ae83-96592d9fbf76", "2c1ec03e-fe0a-41ad-ae83-96592d9fbf76" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List", "Get-AzImageBuilderTemplate_List" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055601Z:e66a7aef-4a29-4bd5-b4fc-c5af5cc8cc59" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11969" ], + "x-ms-correlation-request-id": [ "e66a7aef-4a29-4bd5-b4fc-c5af5cc8cc59" ], + "x-ms-request-id": [ "a4cce087-dd2f-4d40-840e-5e147a321f8a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:00 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "7945" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-k28pym\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-z7ahdj\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:42:20.44856507Z\",\n \"endTime\": \"2020-05-11T05:42:22.684127604Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-z7ahdj\",\n \"name\": \"template-name-z7ahdj\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"managed img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-managedimg-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"run-managedimg-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T08:58:18.577793573Z\",\n \"endTime\": \"2020-04-24T09:15:14.011392171Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-managedimg-managedimg\",\n \"name\": \"tmpl-managedimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-platform-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"out-platform-managed\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-27T08:10:00.96310846Z\",\n \"endTime\": \"2020-04-27T08:16:51.36540813Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-platform-managed\",\n \"name\": \"tmpl-platform-managed\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"shared img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-shareimg-managedimg\",\n \"location\": \"eastus\",\n \"runOutputName\": \"shareing-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T10:04:55.922154854Z\",\n \"endTime\": \"2020-04-24T10:36:50.147714341Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-shareimg-managedimg\",\n \"name\": \"tmpl-shareimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ]\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "32" ], + "x-ms-client-request-id": [ "482a59ea-9924-44fa-a03c-8db0231ca19f" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055602Z:bde021ea-ea27-4a26-b43f-e736dcefd6e6" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11968" ], + "x-ms-correlation-request-id": [ "bde021ea-ea27-4a26-b43f-e736dcefd6e6" ], + "x-ms-request-id": [ "39cee9c8-cc18-4465-b48e-f6662033d712" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19969" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"customize\": [\n {\n \"name\": \"RunScriptFromSource\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript.sh\",\n \"sha256Checksum\": \"2c6ff6902a4a52deee69e8db26d0036a53388651008aaf31795bb20dabd21fd8\",\n \"type\": \"Shell\"\n },\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n },\n {\n \"destination\": \"/tmp/index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"d9715d72889fb1a0463d06ce9e89d1d2bd33b2c5e5362a736db6f5a25e601a58\",\n \"sourceUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n },\n {\n \"inline\": [\n \"sudo mkdir /buildArtifacts\",\n \"sudo cp /tmp/index.html /buildArtifacts/index.html\"\n ],\n \"name\": \"setupBuildPath\",\n \"type\": \"Shell\"\n },\n {\n \"inline\": [\n \"sudo apt install unattended-upgrades\"\n ],\n \"name\": \"InstallUpgrades\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseosimg\": \"ubuntu1804\",\n \"source\": \"azVmImageBuilder\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"location\": \"eastus\",\n \"runOutputName\": \"test-linux-image-run-output\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-28T07:50:02.65707297Z\",\n \"endTime\": \"2020-04-28T07:59:56.925799187Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 80,\n \"vmProfile\": {\n \"vmSize\": \"Standard_D1_v2\",\n \"osDiskSizeGB\": 30\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/HelloImageTemplateLinux01\",\n \"name\": \"HelloImageTemplateLinux01\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {\n \"imagebuilderTemplate\": \"ubuntu1804\"\n }\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate\",\n \"name\": \"lucas-imagetemplate\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest-user-assign\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate-user-assign\",\n \"name\": \"lucas-imagetemplate-user-assign\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-shared-img\",\n \"name\": \"managed-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image\",\n \"name\": \"managed-vhd-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image-0\",\n \"name\": \"managed-vhd-image-0\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image02\",\n \"name\": \"managed-vhd-image02\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/image-test\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-01\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-managed-image\",\n \"name\": \"platform-managed-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runoutput-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-shared-img\",\n \"name\": \"platform-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-0jhwg4\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-0jhwg4\",\n \"name\": \"template-name-0jhwg4\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=10\"\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "32", "33" ], + "x-ms-client-request-id": [ "482a59ea-9924-44fa-a03c-8db0231ca19f", "482a59ea-9924-44fa-a03c-8db0231ca19f" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055602Z:fd6943e8-5da2-4b7a-9038-8bc0670d0553" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11967" ], + "x-ms-correlation-request-id": [ "fd6943e8-5da2-4b7a-9038-8bc0670d0553" ], + "x-ms-request-id": [ "e22d1386-e364-4a9e-bb27-a9ed0c39ab4f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "7945" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-k28pym\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-z7ahdj\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:42:20.44856507Z\",\n \"endTime\": \"2020-05-11T05:42:22.684127604Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-z7ahdj\",\n \"name\": \"template-name-z7ahdj\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"managed img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-managedimg-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"run-managedimg-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T08:58:18.577793573Z\",\n \"endTime\": \"2020-04-24T09:15:14.011392171Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-managedimg-managedimg\",\n \"name\": \"tmpl-managedimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-platform-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"out-platform-managed\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-27T08:10:00.96310846Z\",\n \"endTime\": \"2020-04-27T08:16:51.36540813Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-platform-managed\",\n \"name\": \"tmpl-platform-managed\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"shared img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-shareimg-managedimg\",\n \"location\": \"eastus\",\n \"runOutputName\": \"shareing-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T10:04:55.922154854Z\",\n \"endTime\": \"2020-04-24T10:36:50.147714341Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-shareimg-managedimg\",\n \"name\": \"tmpl-shareimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ]\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "34" ], + "x-ms-client-request-id": [ "f8eebaf0-da34-4a13-a7b9-c8544b14e497" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055602Z:9203c27f-8454-4600-9648-03319dab5459" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11966" ], + "x-ms-correlation-request-id": [ "9203c27f-8454-4600-9648-03319dab5459" ], + "x-ms-request-id": [ "e713caea-a8ff-48e9-ab13-b9e42ceba09f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2103" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "1dadbcff-d9d8-4f9a-bc6f-a90906e3bf6a" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055603Z:b4d51ca2-4e1a-48ae-b092-9f29c198859f" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11965" ], + "x-ms-correlation-request-id": [ "b4d51ca2-4e1a-48ae-b092-9f29c198859f" ], + "x-ms-request-id": [ "aa2b0a69-3b27-441b-84aa-b1835d9abfd4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2103" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Get-AzImageBuilderTemplate+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "36" ], + "x-ms-client-request-id": [ "fc62d9dd-5f01-48d5-be04-d0ca7afb85f7" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055603Z:223827ff-1a96-4688-b397-3c07f9c13b96" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11964" ], + "x-ms-correlation-request-id": [ "223827ff-1a96-4688-b397-3c07f9c13b96" ], + "x-ms-request-id": [ "d69a0623-24bc-4d8d-bc49-be673d09a653" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2103" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..75dd337b8733 --- /dev/null +++ b/src/ImageBuilder/test/Get-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzImageBuilderTemplate' { + It 'List' { + $templateList = Get-AzImageBuilderTemplate + $templateList.Count | Should -BeGreaterOrEqual 1 + } + It 'List1' { + $templateList = Get-AzImageBuilderTemplate -ResourceGroupName $env.ResourceGroup + $templateList.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $template.Name | Should -be $env.Resources.Template.templateName10 + } + + It 'GetViaIdentity' { + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $newTemplate = Get-AzImageBuilderTemplate -InputObject $template + $newTemplate.Name | Should -be $env.Resources.Template.templateName10 + } +} diff --git a/src/ImageBuilder/test/New-AzImageBuilderCustomizerObject.Tests.ps1 b/src/ImageBuilder/test/New-AzImageBuilderCustomizerObject.Tests.ps1 new file mode 100644 index 000000000000..1e4c3422e811 --- /dev/null +++ b/src/ImageBuilder/test/New-AzImageBuilderCustomizerObject.Tests.ps1 @@ -0,0 +1,57 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImageBuilderCustomizerObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImageBuilderCustomizerObject' { + It 'WindowsUpdateCustomizer' { + $searchCriterion = "BrowseOnly=0 and IsInstalled=0" + $filters = ("BrowseOnly", "IsInstalled") + $updateLimit = 100 + $customizerName = 'WindowsUpdate' + $customizer = New-AzImageBuilderCustomizerObject -WindowsUpdateCustomizer -Filter $filters -SearchCriterion $searchCriterion -UpdateLimit $updateLimit -CustomizerName $customizerName + $customizer.Name | Should -Be $customizerName + } + + It 'FileCustomizer' { + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $destination = 'c:\\buildArtifacts\\index.html' + $sourceUri = 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + $customizer = New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName $customizerName -Sha256Checksum $sha256Checksum -Destination $destination -SourceUri $sourceUri + $customizer.Name | Should -Be $customizerName + } + + It 'ShellCustomizer' { + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + $customizer.Name | Should -Be $customizerName + } + + It 'PowerShellCustomizer' { + $customizerName = 'settingUpMgmtAgtPath' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $inline = @("mkdir c:\\buildActions", "echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt") + $customizer = New-AzImageBuilderCustomizerObject -PowerShellCustomizer -CustomizerName $customizerName -RunElevated $false -Sha256Checksum $sha256Checksum -Inline $inline + $customizer.Name | Should -Be $customizerName + } + + It 'RestartCustomizer' { + $customizerName = 'WindowsRestart' + $restartCommand = 'shutdown /f /r /t 0 /c \"packer restart\"' + $restartCheckCommand = 'powershell -command "& {Write-Output "restarted."}"' + $restartTimeout = "10m" + $customizer = New-AzImageBuilderCustomizerObject -RestartCustomizer -CustomizerName $customizerName -RestartCommand $restartCommand -RestartCheckCommand $restartCheckCommand -RestartTimeout $restartTimeout + $customizer.Name | Should -Be $customizerName + } +} diff --git a/src/ImageBuilder/test/New-AzImageBuilderDistributorObject.Tests.ps1 b/src/ImageBuilder/test/New-AzImageBuilderDistributorObject.Tests.ps1 new file mode 100644 index 000000000000..2c1e38e63675 --- /dev/null +++ b/src/ImageBuilder/test/New-AzImageBuilderDistributorObject.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImageBuilderDistributorObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImageBuilderDistributorObject' { + It 'VhdDistributor' { + $outName = 'run-template-vhd' + $distributor = New-AzImageBuilderDistributorObject -ArtifactTag @{tag='VHD'} -VhdDistributor -RunOutputName $outName + $distributor.RunOutputName | Should -Be $outName + } + + It 'ManagedImageDistributor' { + $outName = 'run-template-managedimg' + $distributor = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{tag='lucasManage'} -ImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-image' -RunOutputName $outName -Location $env.Location + $distributor.RunOutputName | Should -Be $outName + } + + It 'SharedImageDistributor' { + $outName = 'run-template-sharedimg' + $distributor = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share' -ReplicationRegion $env.RepLocation -RunOutputName $outName -ExcludeFromLatest $false + $distributor.RunOutputName | Should -Be $outName + } +} diff --git a/src/ImageBuilder/test/New-AzImageBuilderSourceObject.Tests.ps1 b/src/ImageBuilder/test/New-AzImageBuilderSourceObject.Tests.ps1 new file mode 100644 index 000000000000..bf3072d7e549 --- /dev/null +++ b/src/ImageBuilder/test/New-AzImageBuilderSourceObject.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImageBuilderSourceObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImageBuilderSourceObject' { + It 'PlatformImage' { + $publisher = 'Canonical' + $offer = 'UbuntuServer' + $sku = '18.04-LTS' + $version = 'latest' + $planInfoPlanName = 'UbuntuServer' + # New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'Canonical' -Offer 'UbuntuServer' -Sku '18.04-LTS' -Version 'latest' -PlanInfoPlanName 'Canonical' -PlanInfoPlanProduct 'UbuntuServer' -PlanInfoPlanPublisher 'Canonical' + {New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher $publisher -Offer $offer -Sku $sku -Version $version} | Should -Not -Throw + } + + It 'ManagedImage' { + $imageId = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image' + {New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $imageId} | Should -Not -Throw + } + + It 'SharedImageVersion' { + $imageVersionId = '/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0' + {New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId $imageVersionId} | Should -Not -Throw + } +} diff --git a/src/ImageBuilder/test/New-AzImageBuilderTemplate.Recording.json b/src/ImageBuilder/test/New-AzImageBuilderTemplate.Recording.json new file mode 100644 index 000000000000..d2422e13442b --- /dev/null +++ b/src/ImageBuilder/test/New-AzImageBuilderTemplate.Recording.json @@ -0,0 +1,1674 @@ +{ + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"PlatformImage\",\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"ManagedImage\",\n \"artifactTags\": {\n \"source\": \"azVmPlatform\",\n \"baseofimg\": \"UbuntuServer\"\n },\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1273" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/fe1c9cdd-caa3-4ee0-ada7-a5a7d5b1d4f3?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "c916099c-4317-4250-8ebd-51c42fade5da" ], + "x-ms-request-id": [ "fe1c9cdd-caa3-4ee0-ada7-a5a7d5b1d4f3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055613Z:c916099c-4317-4250-8ebd-51c42fade5da" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1507" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/fe1c9cdd-caa3-4ee0-ada7-a5a7d5b1d4f3?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/fe1c9cdd-caa3-4ee0-ada7-a5a7d5b1d4f3?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "37", "38" ], + "x-ms-client-request-id": [ "01d84e30-0a39-4da7-aaf7-23bc2aedf421", "01d84e30-0a39-4da7-aaf7-23bc2aedf421" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11963" ], + "x-ms-correlation-request-id": [ "4da8c4a0-d234-4230-9425-5e1799c26bc0" ], + "x-ms-request-id": [ "35842a2d-d1f5-46a6-89c4-001bacb7771d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055643Z:4da8c4a0-d234-4230-9425-5e1799c26bc0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"FE1C9CDD-CAA3-4EE0-ADA7-A5A7D5B1D4F3\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T05:56:10.9717818Z\",\n \"endTime\": \"2020-05-11T05:56:38.3801693Z\"\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "37", "38", "39" ], + "x-ms-client-request-id": [ "01d84e30-0a39-4da7-aaf7-23bc2aedf421", "01d84e30-0a39-4da7-aaf7-23bc2aedf421", "01d84e30-0a39-4da7-aaf7-23bc2aedf421" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11962" ], + "x-ms-correlation-request-id": [ "e9d8f3a0-cd40-4e64-a394-b30a40e40cfe" ], + "x-ms-request-id": [ "796c0de1-26a2-491e-a71e-8b1349d1de52" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055644Z:e9d8f3a0-cd40-4e64-a394-b30a40e40cfe" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1644" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "40" ], + "x-ms-client-request-id": [ "bfc970cc-46b7-496a-93cf-8bca839d6635" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11961" ], + "x-ms-correlation-request-id": [ "c8810772-1284-4b49-8bbb-cd253e187eb5" ], + "x-ms-request-id": [ "94044392-68c8-4926-a34f-13909c3d37fd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055645Z:c8810772-1284-4b49-8bbb-cd253e187eb5" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1644" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14+5": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"PlatformImage\",\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"File\",\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"ManagedImage\",\n \"artifactTags\": {\n \"source\": \"azVmPlatform\",\n \"baseofimg\": \"MicrosoftWindowsServer\"\n },\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1376" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/35344b8f-f38d-4a45-8187-f294ccd98694?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "b403c2cd-2092-4328-a939-aed770c73b87" ], + "x-ms-request-id": [ "35344b8f-f38d-4a45-8187-f294ccd98694" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055649Z:b403c2cd-2092-4328-a939-aed770c73b87" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:56:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1606" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"MicrosoftWindowsServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw\",\n \"name\": \"template-name-ij2xlw\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/35344b8f-f38d-4a45-8187-f294ccd98694?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/35344b8f-f38d-4a45-8187-f294ccd98694?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "41", "42" ], + "x-ms-client-request-id": [ "5847a388-0fc7-4b80-a748-fd36c755b6be", "5847a388-0fc7-4b80-a748-fd36c755b6be" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11960" ], + "x-ms-correlation-request-id": [ "072d90f9-aebe-443f-a46c-d4a742aa24ba" ], + "x-ms-request-id": [ "f37490af-05cc-472c-b858-77f9451604a9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055720Z:072d90f9-aebe-443f-a46c-d4a742aa24ba" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "254" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"35344B8F-F38D-4A45-8187-F294CCD98694\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T05:56:48.1751273Z\",\n \"endTime\": \"2020-05-11T05:57:15.0000392Z\",\n \"error\": {\n \"code\": \"InternalOperationError\",\n \"message\": \"Internal error occurred.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "41", "42", "43" ], + "x-ms-client-request-id": [ "5847a388-0fc7-4b80-a748-fd36c755b6be", "5847a388-0fc7-4b80-a748-fd36c755b6be", "5847a388-0fc7-4b80-a748-fd36c755b6be" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11959" ], + "x-ms-correlation-request-id": [ "8576983e-29cc-4dbf-a696-e0db98806233" ], + "x-ms-request-id": [ "c4c55663-92f9-4b0f-bd88-7df95b42d1ab" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055720Z:8576983e-29cc-4dbf-a696-e0db98806233" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1867" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"MicrosoftWindowsServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw\",\n \"name\": \"template-name-ij2xlw\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "44" ], + "x-ms-client-request-id": [ "af984ed0-ed68-488d-9362-bdd60adc0c50" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11958" ], + "x-ms-correlation-request-id": [ "a77d45b3-5508-49b0-8715-1d4141d178b2" ], + "x-ms-request-id": [ "ca28209b-303b-4066-9985-7f4a66c081e6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055720Z:a77d45b3-5508-49b0-8715-1d4141d178b2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:20 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1867" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"MicrosoftWindowsServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw\",\n \"name\": \"template-name-ij2xlw\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-vhd+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"PlatformImage\",\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"version\": \"latest\"\n },\n \"distribute\": [\n {\n \"type\": \"VHD\",\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "686" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/da738d19-d31c-4e49-9317-a992df7c25ee?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "5caa39a0-2ce6-4a58-8db4-2c3f34ab7639" ], + "x-ms-request-id": [ "da738d19-d31c-4e49-9317-a992df7c25ee" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055725Z:5caa39a0-2ce6-4a58-8db4-2c3f34ab7639" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "959" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/da738d19-d31c-4e49-9317-a992df7c25ee?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/da738d19-d31c-4e49-9317-a992df7c25ee?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "45", "46" ], + "x-ms-client-request-id": [ "19698d96-70ba-4848-a1a3-545a1188ee79", "19698d96-70ba-4848-a1a3-545a1188ee79" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11957" ], + "x-ms-correlation-request-id": [ "58fd04b4-e855-4d47-8eee-1f326c25ed60" ], + "x-ms-request-id": [ "aa8d7901-405d-468d-af14-ae97913f87fe" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055756Z:58fd04b4-e855-4d47-8eee-1f326c25ed60" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"DA738D19-D31C-4E49-9317-A992DF7C25EE\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T05:57:24.0661277Z\",\n \"endTime\": \"2020-05-11T05:57:32.5040714Z\"\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "45", "46", "47" ], + "x-ms-client-request-id": [ "19698d96-70ba-4848-a1a3-545a1188ee79", "19698d96-70ba-4848-a1a3-545a1188ee79", "19698d96-70ba-4848-a1a3-545a1188ee79" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11956" ], + "x-ms-correlation-request-id": [ "5fda013b-26dd-4a64-bb09-05d1da7226e2" ], + "x-ms-request-id": [ "d63551f8-e738-4a1c-a8de-539aa3f9eef8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055756Z:5fda013b-26dd-4a64-bb09-05d1da7226e2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1096" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "48" ], + "x-ms-client-request-id": [ "797ce1a1-234b-43ee-b302-f6b7b3d561a4" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11955" ], + "x-ms-correlation-request-id": [ "b9d72c3c-5daf-4fba-b2fb-c2cdad3df688" ], + "x-ms-request-id": [ "14fe7c89-051a-40f4-b371-96b94b56f145" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055757Z:b9d72c3c-5daf-4fba-b2fb-c2cdad3df688" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:57:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1096" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"PlatformImage\",\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"SharedImage\",\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"runOutputName\": \"runout-template-name-mdak42\",\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [ \"eastus2\" ]\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1339" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/225f32a3-4604-450b-8b5a-35d4c6416d74?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "6baad93c-7453-4253-b61a-32f7ec42cb88" ], + "x-ms-request-id": [ "225f32a3-4604-450b-8b5a-35d4c6416d74" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055803Z:6baad93c-7453-4253-b61a-32f7ec42cb88" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:58:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1583" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-mdak42\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42\",\n \"name\": \"template-name-mdak42\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/225f32a3-4604-450b-8b5a-35d4c6416d74?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/225f32a3-4604-450b-8b5a-35d4c6416d74?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "49", "50" ], + "x-ms-client-request-id": [ "17b5f76a-845c-45e0-818e-c9a0e2ee179c", "17b5f76a-845c-45e0-818e-c9a0e2ee179c" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11954" ], + "x-ms-correlation-request-id": [ "7e64b5f6-14e4-4dfb-ab14-5cadc40f64d0" ], + "x-ms-request-id": [ "32cfe717-56ab-4384-ab2e-c9e64f205a64" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055834Z:7e64b5f6-14e4-4dfb-ab14-5cadc40f64d0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:58:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "496" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"225F32A3-4604-450B-8B5A-35D4C6416D74\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T05:58:01.7070056Z\",\n \"endTime\": \"2020-05-11T05:58:25.7668176Z\",\n \"error\": {\n \"code\": \"Unauthorized\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "49", "50", "51" ], + "x-ms-client-request-id": [ "17b5f76a-845c-45e0-818e-c9a0e2ee179c", "17b5f76a-845c-45e0-818e-c9a0e2ee179c", "17b5f76a-845c-45e0-818e-c9a0e2ee179c" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055834Z:69973c0f-2e33-4497-be7a-48f108c1e0df" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11953" ], + "x-ms-correlation-request-id": [ "69973c0f-2e33-4497-be7a-48f108c1e0df" ], + "x-ms-request-id": [ "35e017f2-b842-409f-a22e-08c64a81186e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:58:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2096" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-mdak42\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42\",\n \"name\": \"template-name-mdak42\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "52" ], + "x-ms-client-request-id": [ "5936fe08-b981-4e01-991c-96c28b50339c" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055834Z:44916c78-95b6-4b49-8e63-c8dcba113913" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11952" ], + "x-ms-correlation-request-id": [ "44916c78-95b6-4b49-8e63-c8dcba113913" ], + "x-ms-request-id": [ "3c2e07f5-4089-43f6-8244-ebc884199e52" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:58:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2096" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-mdak42\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42\",\n \"name\": \"template-name-mdak42\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14+5": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"PlatformImage\",\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"File\",\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"SharedImage\",\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [ \"eastus2\" ]\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1427" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/23f5e71c-894a-488b-b837-0dda541fe3c4?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "a429b1e4-d878-4525-a2b4-3e859224884b" ], + "x-ms-request-id": [ "23f5e71c-894a-488b-b837-0dda541fe3c4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055839Z:a429b1e4-d878-4525-a2b4-3e859224884b" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:58:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1667" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab\",\n \"name\": \"template-name-32uiab\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/23f5e71c-894a-488b-b837-0dda541fe3c4?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/23f5e71c-894a-488b-b837-0dda541fe3c4?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "53", "54" ], + "x-ms-client-request-id": [ "281ff58f-54cf-4634-b0a5-f9b1dc4f3e90", "281ff58f-54cf-4634-b0a5-f9b1dc4f3e90" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11951" ], + "x-ms-correlation-request-id": [ "557e189a-bc2a-4ae4-899d-df292f069047" ], + "x-ms-request-id": [ "aaed3863-f7cd-4a66-b958-d0ab406bd232" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055910Z:557e189a-bc2a-4ae4-899d-df292f069047" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "254" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"23F5E71C-894A-488B-B837-0DDA541FE3C4\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T05:58:37.9415855Z\",\n \"endTime\": \"2020-05-11T05:59:00.7251281Z\",\n \"error\": {\n \"code\": \"InternalOperationError\",\n \"message\": \"Internal error occurred.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "53", "54", "55" ], + "x-ms-client-request-id": [ "281ff58f-54cf-4634-b0a5-f9b1dc4f3e90", "281ff58f-54cf-4634-b0a5-f9b1dc4f3e90", "281ff58f-54cf-4634-b0a5-f9b1dc4f3e90" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11950" ], + "x-ms-correlation-request-id": [ "f81bc408-9589-49ca-ada2-02e9568d56a2" ], + "x-ms-request-id": [ "a08d9ce1-4aea-44ae-ab1e-26b6506705fd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055911Z:f81bc408-9589-49ca-ada2-02e9568d56a2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1928" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab\",\n \"name\": \"template-name-32uiab\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+platformimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "56" ], + "x-ms-client-request-id": [ "29567cfe-adf5-48a4-a1c3-00017091d045" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11949" ], + "x-ms-correlation-request-id": [ "5292964e-a1e2-442d-82eb-2679db053e0f" ], + "x-ms-request-id": [ "d73f7a29-b997-4b8b-935b-9984da24a283" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055911Z:5292964e-a1e2-442d-82eb-2679db053e0f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1928" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab\",\n \"name\": \"template-name-32uiab\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-managedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"ManagedImage\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"ManagedImage\",\n \"artifactTags\": {\n \"source\": \"azVmMangedImage\",\n \"baseofimg\": \"UbuntuServer\"\n },\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1319" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0c734458-bad6-4854-b61c-0eff96f39330?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "f1ed980f-d251-4270-a107-48db6e55468c" ], + "x-ms-request-id": [ "0c734458-bad6-4854-b61c-0eff96f39330" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055917Z:f1ed980f-d251-4270-a107-48db6e55468c" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1562" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmMangedImage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv\",\n \"name\": \"template-name-suq1dv\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0c734458-bad6-4854-b61c-0eff96f39330?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0c734458-bad6-4854-b61c-0eff96f39330?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "57", "58" ], + "x-ms-client-request-id": [ "fbce14c3-48b1-4af1-b355-1776448918d0", "fbce14c3-48b1-4af1-b355-1776448918d0" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11947" ], + "x-ms-correlation-request-id": [ "e978f744-40c3-496d-8d92-53e67663e511" ], + "x-ms-request-id": [ "ef17fb4b-23cf-40a1-bbfe-e90f64729d62" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055947Z:e978f744-40c3-496d-8d92-53e67663e511" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "253" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"0C734458-BAD6-4854-B61C-0EFF96F39330\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T05:59:15.770159Z\",\n \"endTime\": \"2020-05-11T05:59:25.5339664Z\",\n \"error\": {\n \"code\": \"InternalOperationError\",\n \"message\": \"Internal error occurred.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "57", "58", "59" ], + "x-ms-client-request-id": [ "fbce14c3-48b1-4af1-b355-1776448918d0", "fbce14c3-48b1-4af1-b355-1776448918d0", "fbce14c3-48b1-4af1-b355-1776448918d0" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11946" ], + "x-ms-correlation-request-id": [ "b29705db-408e-497b-b19a-a50cc1bb9a4d" ], + "x-ms-request-id": [ "9bff139d-78c3-4e0d-b908-9b64154f3427" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055948Z:b29705db-408e-497b-b19a-a50cc1bb9a4d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1802" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmMangedImage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv\",\n \"name\": \"template-name-suq1dv\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "51a7c7b1-ff33-489b-8c33-af60de8c82ad" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11945" ], + "x-ms-correlation-request-id": [ "5a763e74-70a4-4abf-91d8-18b7dc4c15b7" ], + "x-ms-request-id": [ "2ecf3d46-a185-4b73-a065-3edcec7b81db" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T055948Z:5a763e74-70a4-4abf-91d8-18b7dc4c15b7" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 05:59:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1802" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmMangedImage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv\",\n \"name\": \"template-name-suq1dv\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-vhd+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"ManagedImage\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"VHD\",\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1066" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0d42fea0-6aca-4833-9fc3-2b69033fc293?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "169f4738-a597-4854-835d-c948d4eda946" ], + "x-ms-request-id": [ "0d42fea0-6aca-4833-9fc3-2b69033fc293" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060026Z:169f4738-a597-4854-835d-c948d4eda946" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:00:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1322" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b\",\n \"name\": \"template-name-2aji6b\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0d42fea0-6aca-4833-9fc3-2b69033fc293?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/0d42fea0-6aca-4833-9fc3-2b69033fc293?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "61", "62" ], + "x-ms-client-request-id": [ "c16fa776-ec9c-43d5-bc82-f0b54efab12d", "c16fa776-ec9c-43d5-bc82-f0b54efab12d" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11944" ], + "x-ms-correlation-request-id": [ "15143fd9-71a2-40a4-a591-9d492ae22b58" ], + "x-ms-request-id": [ "bc4e30e3-3b79-40d5-81c9-7e26e119b96a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060057Z:15143fd9-71a2-40a4-a591-9d492ae22b58" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:00:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "254" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"0D42FEA0-6ACA-4833-9FC3-2B69033FC293\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T06:00:12.7239294Z\",\n \"endTime\": \"2020-05-11T06:00:17.0715786Z\",\n \"error\": {\n \"code\": \"InternalOperationError\",\n \"message\": \"Internal error occurred.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "61", "62", "63" ], + "x-ms-client-request-id": [ "c16fa776-ec9c-43d5-bc82-f0b54efab12d", "c16fa776-ec9c-43d5-bc82-f0b54efab12d", "c16fa776-ec9c-43d5-bc82-f0b54efab12d" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11943" ], + "x-ms-correlation-request-id": [ "6e03a37d-efe4-48a1-b708-315dfb27d247" ], + "x-ms-request-id": [ "9adf2311-e410-4aed-9860-7fd8ca3fcc98" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060057Z:6e03a37d-efe4-48a1-b708-315dfb27d247" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:00:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1562" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b\",\n \"name\": \"template-name-2aji6b\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "64" ], + "x-ms-client-request-id": [ "bdb5f6b6-76ea-49c8-8873-663396539d9b" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11942" ], + "x-ms-correlation-request-id": [ "e1a32c85-a44a-43b2-853d-883dd4282b4d" ], + "x-ms-request-id": [ "cf3472ce-1992-4c48-828b-862bd88285a0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060058Z:e1a32c85-a44a-43b2-853d-883dd4282b4d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:00:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1562" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b\",\n \"name\": \"template-name-2aji6b\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-sharedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"ManagedImage\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"SharedImage\",\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [ \"eastus2\" ]\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1383" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/2784b544-68bb-40a4-9ed3-a36789a1c9bf?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "c73ae6a7-0b7d-464b-8a6c-84ff6e0cebf2" ], + "x-ms-request-id": [ "2784b544-68bb-40a4-9ed3-a36789a1c9bf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060103Z:c73ae6a7-0b7d-464b-8a6c-84ff6e0cebf2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:01:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1636" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey\",\n \"name\": \"template-name-knv6ey\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/2784b544-68bb-40a4-9ed3-a36789a1c9bf?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/2784b544-68bb-40a4-9ed3-a36789a1c9bf?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "65", "66" ], + "x-ms-client-request-id": [ "ead09897-b509-4271-9972-300c20030dfb", "ead09897-b509-4271-9972-300c20030dfb" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11941" ], + "x-ms-correlation-request-id": [ "b3984e6c-59c0-4348-9691-dd2b3afae6d1" ], + "x-ms-request-id": [ "444841d2-628b-4d34-bd25-901cccbd1acb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060134Z:b3984e6c-59c0-4348-9691-dd2b3afae6d1" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:01:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "254" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"2784B544-68BB-40A4-9ED3-A36789A1C9BF\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T06:01:02.2711352Z\",\n \"endTime\": \"2020-05-11T06:01:07.0566622Z\",\n \"error\": {\n \"code\": \"InternalOperationError\",\n \"message\": \"Internal error occurred.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "65", "66", "67" ], + "x-ms-client-request-id": [ "ead09897-b509-4271-9972-300c20030dfb", "ead09897-b509-4271-9972-300c20030dfb", "ead09897-b509-4271-9972-300c20030dfb" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11940" ], + "x-ms-correlation-request-id": [ "d1b39da6-afbe-42fb-bcea-54e9e4947694" ], + "x-ms-request-id": [ "6f111e9e-658f-4058-9ab1-3fcf71626f9a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060134Z:d1b39da6-afbe-42fb-bcea-54e9e4947694" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:01:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1876" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey\",\n \"name\": \"template-name-knv6ey\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+managedimg-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "68" ], + "x-ms-client-request-id": [ "780a1725-14b5-4bc2-bb2f-ec83fe307b8a" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11939" ], + "x-ms-correlation-request-id": [ "fa2b57d3-78fc-4c98-aced-ea6b04d97fb0" ], + "x-ms-request-id": [ "3993a491-a3b4-480d-bac2-7f1bf13c6d74" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060135Z:fa2b57d3-78fc-4c98-aced-ea6b04d97fb0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:01:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1876" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey\",\n \"name\": \"template-name-knv6ey\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-managedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"SharedImageVersion\",\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"ManagedImage\",\n \"artifactTags\": {\n \"source\": \"azVmPlatform\",\n \"baseofimg\": \"UbuntuServer\"\n },\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1377" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/f8d4fa1b-5e1a-472f-8c6e-d5c11140c1bd?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "bb69cbd1-0079-4d67-9680-49e659f9b647" ], + "x-ms-request-id": [ "f8d4fa1b-5e1a-472f-8c6e-d5c11140c1bd" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060140Z:bb69cbd1-0079-4d67-9680-49e659f9b647" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:01:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1620" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg\",\n \"name\": \"template-name-i6romg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/f8d4fa1b-5e1a-472f-8c6e-d5c11140c1bd?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/f8d4fa1b-5e1a-472f-8c6e-d5c11140c1bd?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "69", "70" ], + "x-ms-client-request-id": [ "b9d7574c-5a7a-4534-b592-9a1182b6d5aa", "b9d7574c-5a7a-4534-b592-9a1182b6d5aa" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11938" ], + "x-ms-correlation-request-id": [ "7aca4d17-6ca1-4625-baa1-40b972f7725f" ], + "x-ms-request-id": [ "a8698c14-eec4-4fbc-9c02-6ce9abdcb484" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060210Z:7aca4d17-6ca1-4625-baa1-40b972f7725f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "511" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"F8D4FA1B-5E1A-472F-8C6E-D5C11140C1BD\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T06:01:38.6151262Z\",\n \"endTime\": \"2020-05-11T06:01:46.0129162Z\",\n \"error\": {\n \"code\": \"Unauthorized\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "69", "70", "71" ], + "x-ms-client-request-id": [ "b9d7574c-5a7a-4534-b592-9a1182b6d5aa", "b9d7574c-5a7a-4534-b592-9a1182b6d5aa", "b9d7574c-5a7a-4534-b592-9a1182b6d5aa" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060211Z:6ced5e76-3594-47fc-8dbe-5146fa6d0de1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11937" ], + "x-ms-correlation-request-id": [ "6ced5e76-3594-47fc-8dbe-5146fa6d0de1" ], + "x-ms-request-id": [ "8c67fb60-d75e-49ae-a2a9-aa1e4e42eef3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2133" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg\",\n \"name\": \"template-name-i6romg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-managedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "72" ], + "x-ms-client-request-id": [ "0de1612e-9294-418c-ac37-da776ec4e0b0" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060212Z:d389b1ba-01e7-47a5-bff8-5b4be580a151" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11936" ], + "x-ms-correlation-request-id": [ "d389b1ba-01e7-47a5-bff8-5b4be580a151" ], + "x-ms-request-id": [ "683044e4-7675-4ad1-9c1a-3dcfcee863a3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2133" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg\",\n \"name\": \"template-name-i6romg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-vhd+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"SharedImageVersion\",\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"VHD\",\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\"\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1127" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/3034328e-110f-42a3-a421-622bcf6131a9?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "88fa152d-cb36-4c70-a500-c05760cf5e09" ], + "x-ms-request-id": [ "3034328e-110f-42a3-a421-622bcf6131a9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060218Z:88fa152d-cb36-4c70-a500-c05760cf5e09" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1383" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6\",\n \"name\": \"template-name-ktxvh6\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/3034328e-110f-42a3-a421-622bcf6131a9?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/3034328e-110f-42a3-a421-622bcf6131a9?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74" ], + "x-ms-client-request-id": [ "f4092529-73b5-46cc-9192-fc4c19bbe402", "f4092529-73b5-46cc-9192-fc4c19bbe402" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11935" ], + "x-ms-correlation-request-id": [ "2ad44cfb-f5e5-4d37-8949-913ce2f73f8a" ], + "x-ms-request-id": [ "40b567ef-0669-4a1d-b196-709d6b5750e6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060248Z:2ad44cfb-f5e5-4d37-8949-913ce2f73f8a" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "511" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"3034328E-110F-42A3-A421-622BCF6131A9\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T06:02:16.5528553Z\",\n \"endTime\": \"2020-05-11T06:02:21.4139336Z\",\n \"error\": {\n \"code\": \"Unauthorized\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75" ], + "x-ms-client-request-id": [ "f4092529-73b5-46cc-9192-fc4c19bbe402", "f4092529-73b5-46cc-9192-fc4c19bbe402", "f4092529-73b5-46cc-9192-fc4c19bbe402" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11934" ], + "x-ms-correlation-request-id": [ "bb0775c3-073f-4c04-8321-e64a386f8685" ], + "x-ms-request-id": [ "3e09b8af-b5ec-45ad-a55d-85af63a175de" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060249Z:bb0775c3-073f-4c04-8321-e64a386f8685" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1896" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6\",\n \"name\": \"template-name-ktxvh6\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedimg-vhd+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "76" ], + "x-ms-client-request-id": [ "14559817-b4b8-48da-b510-b1d1bb9075d8" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11933" ], + "x-ms-correlation-request-id": [ "3642063c-037a-488d-9b52-440a4cefcef3" ], + "x-ms-request-id": [ "14ec0e0a-2350-4266-9ac9-cc669a593e4b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060249Z:3642063c-037a-488d-9b52-440a4cefcef3" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1896" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6\",\n \"name\": \"template-name-ktxvh6\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedImage-sharedimg+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14", + "Content": "{\n \"location\": \"eastus\",\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n }\n }\n },\n \"properties\": {\n \"source\": {\n \"type\": \"SharedImageVersion\",\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"type\": \"Shell\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\"\n }\n ],\n \"distribute\": [\n {\n \"type\": \"SharedImage\",\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [ \"eastus2\" ]\n }\n ]\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1443" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1188" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/1d744f7b-e500-4535-970d-9bdfe3d2aecb?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "ebe039a6-0dfd-468b-b22b-6128b155e2bf" ], + "x-ms-request-id": [ "1d744f7b-e500-4535-970d-9bdfe3d2aecb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060254Z:ebe039a6-0dfd-468b-b22b-6128b155e2bf" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:02:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1696" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Creating\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {}\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz\",\n \"name\": \"template-name-k2fhvz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedImage-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/1d744f7b-e500-4535-970d-9bdfe3d2aecb?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/1d744f7b-e500-4535-970d-9bdfe3d2aecb?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "77", "78" ], + "x-ms-client-request-id": [ "d5fd6dd7-7062-48ea-a7ea-ae001d0ac380", "d5fd6dd7-7062-48ea-a7ea-ae001d0ac380" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11932" ], + "x-ms-correlation-request-id": [ "5d4829d0-318f-453c-9ad4-a6017bf6c783" ], + "x-ms-request-id": [ "edc50b3f-26cd-428b-9acd-d79ed1b29cab" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060324Z:5d4829d0-318f-453c-9ad4-a6017bf6c783" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:03:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "510" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"1D744F7B-E500-4535-970D-9BDFE3D2AECB\",\n \"status\": \"Failed\",\n \"startTime\": \"2020-05-11T06:02:52.834394Z\",\n \"endTime\": \"2020-05-11T06:02:57.1995215Z\",\n \"error\": {\n \"code\": \"Unauthorized\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n }\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedImage-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "77", "78", "79" ], + "x-ms-client-request-id": [ "d5fd6dd7-7062-48ea-a7ea-ae001d0ac380", "d5fd6dd7-7062-48ea-a7ea-ae001d0ac380", "d5fd6dd7-7062-48ea-a7ea-ae001d0ac380" ], + "CommandName": [ "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate", "Az.ImageBuilder.internal\\New-AzImageBuilderTemplate" ], + "FullCommandName": [ "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create", "New-AzImageBuilderTemplate_Create" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060326Z:d2fe5ffb-024b-460f-b081-b96f1b4732cc" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11931" ], + "x-ms-correlation-request-id": [ "d2fe5ffb-024b-460f-b081-b96f1b4732cc" ], + "x-ms-request-id": [ "faf333d1-2abb-4e3b-9b3c-b28216c240b0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:03:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz\",\n \"name\": \"template-name-k2fhvz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "New-AzImageBuilderTemplate+[NoContext]+sharedImage-sharedimg+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "80" ], + "x-ms-client-request-id": [ "9142611e-9df3-4584-8f4e-3c98214f3270" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060326Z:a956d6c5-970b-43fb-9b1a-43ddb9cd97fc" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11930" ], + "x-ms-correlation-request-id": [ "a956d6c5-970b-43fb-9b1a-43ddb9cd97fc" ], + "x-ms-request-id": [ "23d680ef-eac5-4ac4-9dde-3124bb8bc329" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:03:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2209" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz\",\n \"name\": \"template-name-k2fhvz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/New-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/New-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..19ca4d13f065 --- /dev/null +++ b/src/ImageBuilder/test/New-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,196 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImageBuilderTemplate' { + #1 Source: PlatformImage Distributor: ManagedImage + It 'platformimg-managedimg' { + #region OS:Linux + $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher $env.Source.PlatformImageLinux.publisher -Offer $env.Source.PlatformImageLinux.offer -Sku $env.Source.PlatformImageLinux.sku -Version $env.Source.PlatformImageLinux.version + $disManagedImg = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{source='azVmPlatform';baseofimg='UbuntuServer'} -ImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/$($env.Resources.Distributor.distributorName01)" -Location $env.Location -RunOutputName $env.Resources.RunOutputName.runOutputName21 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName11) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName11 -ResourceGroupName $env.ResourceGroup -Source $srcPlatform -Distribute $disManagedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName11 -ResourceGroupName $env.ResourceGroup + #endregion OS:Linux + + #region OS:Windows + $srcPlatformWind = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'MicrosoftWindowsServer' -Offer 'WindowsServer' -Sku '2019-Datacenter' -Version 'latest' + $disManagedImgWind = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{source='azVmPlatform';baseofimg='MicrosoftWindowsServer'} -ImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/$($env.Resources.Distributor.distributorName001)" -Location $env.Location -RunOutputName $env.Resources.RunOutputName.runOutputName201 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $destination = 'c:\\buildArtifacts\\index.html' + $sourceUri = 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + $customizer = New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName $customizerName -Sha256Checksum $sha256Checksum -Destination $destination -SourceUri $sourceUri + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName101 -ResourceGroupName $env.ResourceGroup -Source $srcPlatformWind -Distribute $disManagedImgWind -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $templateWind = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName101 -ResourceGroupName $env.ResourceGroup + #endregion OS:Windows + + $template.ProvisioningState | Should -Be 'Succeeded' + $templateWind.Name | Should -Be $env.Resources.Template.templateName101 + } + #2 Source: PlatformImage Distributor: VHD + It 'platformimg-vhd' { + #region OS:Linux + $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher $env.Source.PlatformImageLinux.publisher -Offer $env.Source.PlatformImageLinux.offer -Sku $env.Source.PlatformImageLinux.sku -Version $env.Source.PlatformImageLinux.version + $disVhd = New-AzImageBuilderDistributorObject -VhdDistributor -ArtifactTag @{tag='VHD'} -RunOutputName $env.Resources.RunOutputName.runOutputName22 + $customizerName = 'HelloImageScript1' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName12) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup -Source $srcPlatform -Distribute $disVhd -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup + $template.ProvisioningState | Should -Be 'Succeeded' + #endregion OS:Linux + } + #3 Source: PlatformImage Distributor: SharedImage + It 'platformimg-sharedimg' { + #region OS:Linux + $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher $env.Source.PlatformImageLinux.publisher -Offer $env.Source.PlatformImageLinux.offer -Sku $env.Source.PlatformImageLinux.sku -Version $env.Source.PlatformImageLinux.version + $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0" -ReplicationRegion $env.RepLocation -RunOutputName $env.Resources.RunOutputName.runOutputName23 -ExcludeFromLatest $false + $customizerName = 'CheckSumCompareShellScript' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName13) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName13 -ResourceGroupName $env.ResourceGroup -Source $srcPlatform -Distribute $disSharedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName13 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + #endregion OS:Linux + + #region OS:Windows + $srcPlatformWind = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher 'MicrosoftWindowsServer' -Offer 'WindowsServer' -Sku '2019-Datacenter' -Version 'latest' + $disSharedImgWind = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0" -ReplicationRegion $env.RepLocation -RunOutputName $env.Resources.RunOutputName.runOutputName203 -ExcludeFromLatest $false + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $destination = 'c:\\buildArtifacts\\index.html' + $sourceUri = 'https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html' + $customizer = New-AzImageBuilderCustomizerObject -FileCustomizer -CustomizerName $customizerName -Sha256Checksum $sha256Checksum -Destination $destination -SourceUri $sourceUri + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName103 -ResourceGroupName $env.ResourceGroup -Source $srcPlatformWind -Distribute $disSharedImgWind -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $templateWind = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName103 -ResourceGroupName $env.ResourceGroup + #endregion OS:Windows + + $template.Name | Should -Be $env.Resources.Template.templateName13 + $templateWind.Name | Should -Be $env.Resources.Template.templateName103 + + } + #4 Source: ManagedImage Distributor: ManagedImage + It 'managedimg-managedimg' { + #region OS:Linux + $srcManagedImg = New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $env.Source.ManagedImageLinux.imageId + $disManagedImg = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{source='azVmMangedImage';baseofimg='UbuntuServer'} -ImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/$($env.Resources.Distributor.distributorName04)" -Location $env.Location -RunOutputName $env.Resources.RunOutputName.runOutputName24 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName14) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName14 -ResourceGroupName $env.ResourceGroup -Source $srcManagedImg -Distribute $disManagedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName14 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName14 + #endregion OS:Linux + } + #4 Source: ManagedImage Distributor: VHD + It 'managedimg-vhd' { + #region OS:Linux + $srcManagedImg = New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $env.Source.ManagedImageLinux.imageId + $disVhd = New-AzImageBuilderDistributorObject -VhdDistributor -ArtifactTag @{tag='VHD'} -RunOutputName $env.Resources.RunOutputName.runOutputName25 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName15) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName15 -ResourceGroupName $env.ResourceGroup -Source $srcManagedImg -Distribute $disVhd -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName15 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName15 + #endregion OS:Linux + } + #6 Source: ManagedImage Distributor: SharedImage + It 'managedimg-sharedimg' { + #region OS:Linux + $srcManagedImg = New-AzImageBuilderSourceObject -SourceTypeManagedImage -ImageId $env.Source.ManagedImageLinux.imageId + $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)" -ReplicationRegion $env.RepLocation -RunOutputName $env.Resources.RunOutputName.runOutputName26 -ExcludeFromLatest $false + $customizerName = 'CheckSumCompareShellScript' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName16) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName16 -ResourceGroupName $env.ResourceGroup -Source $srcManagedImg -Distribute $disSharedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName16 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName16 + #endregion OS:Linux + } + #7 Source: SharedImage Distributor: ManagedImage + It 'sharedimg-managedimg' { + #region OS:Linux + $srcSharedImg = New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId $env.Source.SharedImageLinux.imageVersionId + $disManagedImg = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{source='azVmPlatform';baseofimg='UbuntuServer'} -ImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/$($env.Resources.Distributor.distributorName07)" -Location $env.Location -RunOutputName $env.Resources.RunOutputName.runOutputName27 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName17) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName17 -ResourceGroupName $env.ResourceGroup -Source $srcSharedImg -Distribute $disManagedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName17 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName17 + #endregion OS:Linux + } + #8 Source: SharedImage Distributor: VHD + It 'sharedimg-vhd' { + #region OS:Linux + $srcSharedImg = New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId $env.Source.SharedImageLinux.imageVersionId + $disVhd = New-AzImageBuilderDistributorObject -VhdDistributor -ArtifactTag @{tag='VHD'} -RunOutputName $env.Resources.RunOutputName.runOutputName28 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName18) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName18 -ResourceGroupName $env.ResourceGroup -Source $srcSharedImg -Distribute $disVhd -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName18 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName18 + #endregion OS:Linux + } + + #9 Source: SharedImage Distributor: SharedImage + It 'sharedImage-sharedimg' { + #region OS:Linux + $srcSharedImg = New-AzImageBuilderSourceObject -SourceTypeSharedImageVersion -ImageVersionId $env.Source.SharedImageLinux.imageVersionId + $disSharedImg = New-AzImageBuilderDistributorObject -SharedImageDistributor -ArtifactTag @{tag='dis-share'} -GalleryImageId "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0" -ReplicationRegion $env.RepLocation -RunOutputName $env.Resources.RunOutputName.runOutputName29 -ExcludeFromLatest $false + $customizerName = 'CheckSumCompareShellScript' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + Write-Host -ForegroundColor Green "Start creating $($env.Resources.Template.templateName19) template image." + + New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName19 -ResourceGroupName $env.ResourceGroup -Source $srcSharedImg -Distribute $disSharedImg -Customize $customizer -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName19 -ResourceGroupName $env.ResourceGroup + #$template.ProvisioningState | Should -Be 'Succeeded' + $template.Name | Should -Be $env.Resources.Template.templateName19 + #endregion OS:Linux + } +} diff --git a/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Recording.json b/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Recording.json new file mode 100644 index 000000000000..4699c77e3755 --- /dev/null +++ b/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Recording.json @@ -0,0 +1,667 @@ +{ + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14+1": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-mdak42?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "d8d2031b-3791-43cd-98df-8379d8d20fa7" ], + "x-ms-request-id": [ "b09ea5f8-c948-4b49-9ba3-c0925fe6ca34" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060327Z:d8d2031b-3791-43cd-98df-8379d8d20fa7" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:03:26 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81", "82" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11929" ], + "x-ms-correlation-request-id": [ "83b4eb31-d82c-4bf7-b86e-d12701676b6f" ], + "x-ms-request-id": [ "78b922c5-7287-4cb8-897b-058f108c2bf8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060358Z:83b4eb31-d82c-4bf7-b86e-d12701676b6f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:03:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B09EA5F8-C948-4B49-9BA3-C0925FE6CA34\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:03:27.3346488Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81", "82", "83" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11928" ], + "x-ms-correlation-request-id": [ "3188f306-220c-4981-a3c8-c4f4f66fd356" ], + "x-ms-request-id": [ "7c74241a-d0af-4a64-acc1-801c8d06075a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060428Z:3188f306-220c-4981-a3c8-c4f4f66fd356" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:04:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B09EA5F8-C948-4B49-9BA3-C0925FE6CA34\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:03:27.3346488Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81", "82", "83", "84" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11927" ], + "x-ms-correlation-request-id": [ "7a3fb869-7e24-464c-a17c-531ad949a3af" ], + "x-ms-request-id": [ "6b2a5f4e-4128-4c56-8309-aa6096f299f2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060459Z:7a3fb869-7e24-464c-a17c-531ad949a3af" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:04:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B09EA5F8-C948-4B49-9BA3-C0925FE6CA34\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:03:27.3346488Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81", "82", "83", "84", "85" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11926" ], + "x-ms-correlation-request-id": [ "bb4bc6d3-0e0d-4f9e-bbdf-22c7003141de" ], + "x-ms-request-id": [ "0db5be9d-7268-4a3f-b7fe-42fd00bbfd1d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060529Z:bb4bc6d3-0e0d-4f9e-bbdf-22c7003141de" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B09EA5F8-C948-4B49-9BA3-C0925FE6CA34\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:03:27.3346488Z\",\n \"endTime\": \"2020-05-11T06:05:14.2827262Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b09ea5f8-c948-4b49-9ba3-c0925fe6ca34?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "81", "82", "83", "84", "85", "86" ], + "x-ms-client-request-id": [ "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0", "4bcd8406-c1de-4372-a01e-3a933f32d2c0" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete", "Remove-AzImageBuilderTemplate_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11925" ], + "x-ms-correlation-request-id": [ "4ca37ea3-9535-4938-9a6e-b94bfda8d9ef" ], + "x-ms-request-id": [ "4d4d6df2-a784-4787-bd57-0bd0a2e4a2cb" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060530Z:4ca37ea3-9535-4938-9a6e-b94bfda8d9ef" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B09EA5F8-C948-4B49-9BA3-C0925FE6CA34\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:03:27.3346488Z\",\n \"endTime\": \"2020-05-11T06:05:14.2827262Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "87" ], + "x-ms-client-request-id": [ "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060530Z:5202be59-7eb7-4b4a-9995-503325f63ffe" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11924" ], + "x-ms-correlation-request-id": [ "5202be59-7eb7-4b4a-9995-503325f63ffe" ], + "x-ms-request-id": [ "3013438f-6a6f-4f76-8123-30af23b933fe" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19969" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"customize\": [\n {\n \"name\": \"RunScriptFromSource\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript.sh\",\n \"sha256Checksum\": \"2c6ff6902a4a52deee69e8db26d0036a53388651008aaf31795bb20dabd21fd8\",\n \"type\": \"Shell\"\n },\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n },\n {\n \"destination\": \"/tmp/index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"d9715d72889fb1a0463d06ce9e89d1d2bd33b2c5e5362a736db6f5a25e601a58\",\n \"sourceUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n },\n {\n \"inline\": [\n \"sudo mkdir /buildArtifacts\",\n \"sudo cp /tmp/index.html /buildArtifacts/index.html\"\n ],\n \"name\": \"setupBuildPath\",\n \"type\": \"Shell\"\n },\n {\n \"inline\": [\n \"sudo apt install unattended-upgrades\"\n ],\n \"name\": \"InstallUpgrades\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseosimg\": \"ubuntu1804\",\n \"source\": \"azVmImageBuilder\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"location\": \"eastus\",\n \"runOutputName\": \"test-linux-image-run-output\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-28T07:50:02.65707297Z\",\n \"endTime\": \"2020-04-28T07:59:56.925799187Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 80,\n \"vmProfile\": {\n \"vmSize\": \"Standard_D1_v2\",\n \"osDiskSizeGB\": 30\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/HelloImageTemplateLinux01\",\n \"name\": \"HelloImageTemplateLinux01\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {\n \"imagebuilderTemplate\": \"ubuntu1804\"\n }\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate\",\n \"name\": \"lucas-imagetemplate\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest-user-assign\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate-user-assign\",\n \"name\": \"lucas-imagetemplate-user-assign\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-shared-img\",\n \"name\": \"managed-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image\",\n \"name\": \"managed-vhd-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image-0\",\n \"name\": \"managed-vhd-image-0\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image02\",\n \"name\": \"managed-vhd-image02\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/image-test\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-01\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-managed-image\",\n \"name\": \"platform-managed-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runoutput-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-shared-img\",\n \"name\": \"platform-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-0jhwg4\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-0jhwg4\",\n \"name\": \"template-name-0jhwg4\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=10\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "87", "88" ], + "x-ms-client-request-id": [ "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb", "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060531Z:261b3fc9-3baf-4a4e-ad6c-08fe6d5c60f1" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11923" ], + "x-ms-correlation-request-id": [ "261b3fc9-3baf-4a4e-ad6c-08fe6d5c60f1" ], + "x-ms-request-id": [ "4b01fc5e-649e-4e9f-bf9b-3b2582eaa24a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19700" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b\",\n \"name\": \"template-name-2aji6b\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab\",\n \"name\": \"template-name-32uiab\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg\",\n \"name\": \"template-name-i6romg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"MicrosoftWindowsServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw\",\n \"name\": \"template-name-ij2xlw\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz\",\n \"name\": \"template-name-k2fhvz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey\",\n \"name\": \"template-name-knv6ey\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6\",\n \"name\": \"template-name-ktxvh6\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmMangedImage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv\",\n \"name\": \"template-name-suq1dv\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=20\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=20+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=20", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "87", "88", "89" ], + "x-ms-client-request-id": [ "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb", "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb", "b3b0b1a7-d65e-42f3-8676-17cebe2cfbbb" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060531Z:d9a207e2-ba11-4791-84cc-66327a3c860b" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11922" ], + "x-ms-correlation-request-id": [ "d9a207e2-ba11-4791-84cc-66327a3c860b" ], + "x-ms-request-id": [ "cf1cd95d-046c-494c-91ce-4d22a75b76f5" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "7474" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-k28pym\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-z7ahdj\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:42:20.44856507Z\",\n \"endTime\": \"2020-05-11T05:42:22.684127604Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-z7ahdj\",\n \"name\": \"template-name-z7ahdj\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"managed img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-managedimg-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"run-managedimg-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T08:58:18.577793573Z\",\n \"endTime\": \"2020-04-24T09:15:14.011392171Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-managedimg-managedimg\",\n \"name\": \"tmpl-managedimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-platform-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"out-platform-managed\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-27T08:10:00.96310846Z\",\n \"endTime\": \"2020-04-27T08:16:51.36540813Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-platform-managed\",\n \"name\": \"tmpl-platform-managed\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"shared img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-shareimg-managedimg\",\n \"location\": \"eastus\",\n \"runOutputName\": \"shareing-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T10:04:55.922154854Z\",\n \"endTime\": \"2020-04-24T10:36:50.147714341Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-shareimg-managedimg\",\n \"name\": \"tmpl-shareimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ]\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "90" ], + "x-ms-client-request-id": [ "0039c4a1-99aa-4452-a276-7174e19ce59a" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11921" ], + "x-ms-correlation-request-id": [ "ea3b837f-e9e2-411a-82ae-67f8d946dbc0" ], + "x-ms-request-id": [ "075437d2-4a95-4f1c-bc2c-14c996be6228" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060533Z:ea3b837f-e9e2-411a-82ae-67f8d946dbc0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1876" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0)\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-knv6ey\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey\",\n \"name\": \"template-name-knv6ey\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-knv6ey?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "91" ], + "x-ms-client-request-id": [ "88024a90-294b-44b8-9a94-b616275f7c26" ], + "CommandName": [ "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "7af74bc2-096a-4ec2-b89e-977b1e47b57c" ], + "x-ms-request-id": [ "b6474e89-6fd5-4364-8932-d20fefcff645" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060534Z:7af74bc2-096a-4ec2-b89e-977b1e47b57c" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:05:34 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "91", "92" ], + "x-ms-client-request-id": [ "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11920" ], + "x-ms-correlation-request-id": [ "d7a5278b-bdee-4c32-86a3-234219c26ff0" ], + "x-ms-request-id": [ "458e21d6-061b-4ace-afce-9121990f3938" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060605Z:d7a5278b-bdee-4c32-86a3-234219c26ff0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B6474E89-6FD5-4364-8932-D20FEFCFF645\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:05:34.3823299Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "91", "92", "93" ], + "x-ms-client-request-id": [ "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11919" ], + "x-ms-correlation-request-id": [ "3265e9f8-95e1-44f9-b250-bc51287f8793" ], + "x-ms-request-id": [ "49a2a66a-f6d5-42c6-9eb8-12c87943d07f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060636Z:3265e9f8-95e1-44f9-b250-bc51287f8793" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:35 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "163" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B6474E89-6FD5-4364-8932-D20FEFCFF645\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:05:34.3823299Z\",\n \"endTime\": \"2020-05-11T06:06:23.22433Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/b6474e89-6fd5-4364-8932-d20fefcff645?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "91", "92", "93", "94" ], + "x-ms-client-request-id": [ "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26", "88024a90-294b-44b8-9a94-b616275f7c26" ], + "CommandName": [ "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate", "Remove-AzImageBuilderTemplate" ], + "FullCommandName": [ "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity", "Remove-AzImageBuilderTemplate_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11918" ], + "x-ms-correlation-request-id": [ "523fe8c4-7a2f-4f4f-adba-4c1eebb3be3a" ], + "x-ms-request-id": [ "d5c97637-c244-48d5-9168-a84046461817" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060636Z:523fe8c4-7a2f-4f4f-adba-4c1eebb3be3a" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "163" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"B6474E89-6FD5-4364-8932-D20FEFCFF645\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:05:34.3823299Z\",\n \"endTime\": \"2020-05-11T06:06:23.22433Z\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95" ], + "x-ms-client-request-id": [ "26633a97-d3e6-4390-b53d-862118ee4722" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060637Z:313c2b6b-e508-41a1-9736-09df18421fe8" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11917" ], + "x-ms-correlation-request-id": [ "313c2b6b-e508-41a1-9736-09df18421fe8" ], + "x-ms-request-id": [ "48ee6efd-8ba7-49ed-ac6c-9b3e35700977" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19969" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"customize\": [\n {\n \"name\": \"RunScriptFromSource\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript.sh\",\n \"sha256Checksum\": \"2c6ff6902a4a52deee69e8db26d0036a53388651008aaf31795bb20dabd21fd8\",\n \"type\": \"Shell\"\n },\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n },\n {\n \"destination\": \"/tmp/index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"d9715d72889fb1a0463d06ce9e89d1d2bd33b2c5e5362a736db6f5a25e601a58\",\n \"sourceUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n },\n {\n \"inline\": [\n \"sudo mkdir /buildArtifacts\",\n \"sudo cp /tmp/index.html /buildArtifacts/index.html\"\n ],\n \"name\": \"setupBuildPath\",\n \"type\": \"Shell\"\n },\n {\n \"inline\": [\n \"sudo apt install unattended-upgrades\"\n ],\n \"name\": \"InstallUpgrades\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseosimg\": \"ubuntu1804\",\n \"source\": \"azVmImageBuilder\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"location\": \"eastus\",\n \"runOutputName\": \"test-linux-image-run-output\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-28T07:50:02.65707297Z\",\n \"endTime\": \"2020-04-28T07:59:56.925799187Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 80,\n \"vmProfile\": {\n \"vmSize\": \"Standard_D1_v2\",\n \"osDiskSizeGB\": 30\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/HelloImageTemplateLinux01\",\n \"name\": \"HelloImageTemplateLinux01\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {\n \"imagebuilderTemplate\": \"ubuntu1804\"\n }\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate\",\n \"name\": \"lucas-imagetemplate\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"lucasManage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/lucas-linux-imagetest-user-assign\",\n \"location\": \"eastus\",\n \"runOutputName\": \"lucas-imagetmplrunout\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/lucas-imagetemplate-user-assign\",\n \"name\": \"lucas-imagetemplate-user-assign\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-shared-img\",\n \"name\": \"managed-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image\",\n \"name\": \"managed-vhd-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image-0\",\n \"name\": \"managed-vhd-image-0\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-01\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/managed-vhd-image02\",\n \"name\": \"managed-vhd-image02\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/image-test\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-01\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-managed-image\",\n \"name\": \"platform-managed-image\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runoutput-01\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageDistribute\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/platform-shared-img\",\n \"name\": \"platform-shared-img\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-0jhwg4\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-0jhwg4\",\n \"name\": \"template-name-0jhwg4\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=10\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=10", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96" ], + "x-ms-client-request-id": [ "26633a97-d3e6-4390-b53d-862118ee4722", "26633a97-d3e6-4390-b53d-862118ee4722" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060638Z:b3d3e6f6-0dad-47d0-9fec-3ff0c03cdbc7" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11916" ], + "x-ms-correlation-request-id": [ "b3d3e6f6-0dad-47d0-9fec-3ff0c03cdbc7" ], + "x-ms-request-id": [ "df7895c9-15fe-4699-b111-4674dcfffab4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "19462" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-2aji6b\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-2aji6b\",\n \"name\": \"template-name-2aji6b\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-wind/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-32uiab\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-32uiab\",\n \"name\": \"template-name-32uiab\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-xqmc4s\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-i6romg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-i6romg\",\n \"name\": \"template-name-i6romg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"WindowsServer\",\n \"publisher\": \"MicrosoftWindowsServer\",\n \"sku\": \"2019-Datacenter\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (17763.1158.2004131759)\"\n },\n \"customize\": [\n {\n \"destination\": \"c:\\\\\\\\buildArtifacts\\\\\\\\index.html\",\n \"name\": \"downloadBuildArtifacts\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"sourceUri\": \"https://github.com/danielsollondon/azvmimagebuilder/blob/master/quickquickstarts/exampleArtifacts/buildArtifacts/index.html\",\n \"type\": \"File\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"MicrosoftWindowsServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-8ibsuk\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-ij2xlw\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"NoCustomizerScript\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ij2xlw\",\n \"name\": \"template-name-ij2xlw\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"CheckSumCompareShellScript\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"dis-share\"\n },\n \"excludeFromLatest\": false,\n \"galleryImageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"replicationRegions\": [\n \"eastus2\"\n ],\n \"runOutputName\": \"runout-template-name-k2fhvz\",\n \"type\": \"SharedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-k2fhvz\",\n \"name\": \"template-name-k2fhvz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:45:38.327796429Z\",\n \"endTime\": \"2020-05-11T05:55:47.153496599Z\",\n \"runState\": \"Failed\",\n \"message\": \"{\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Failed in distributing 1 images out of total 1: Some error happened, please check the error details.\\\",\\n \\\"details\\\": [\\n {\\n \\\"code\\\": \\\"InternalOperationError\\\",\\n \\\"message\\\": \\\"Internal error occurred.\\\"\\n }\\n ]\\n }\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-ktxvh6\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadSharedImageVersionSource\",\n \"message\": \"Not authorized to access the resource: /subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0. To resolve this issue, go to https://aka.ms/azvmimagebuilderts.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-ktxvh6\",\n \"name\": \"template-name-ktxvh6\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmMangedImage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-2ecfok\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-suq1dv\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Failed\",\n \"provisioningError\": {\n \"provisioningErrorCode\": \"BadManagedImageSource\",\n \"message\": \"Internal error occurred.\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-suq1dv\",\n \"name\": \"template-name-suq1dv\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ],\n \"nextLink\": \"https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\\u0026skipToken=20\"\n}" + } + }, + "Remove-AzImageBuilderTemplate+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=20+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates?api-version=2020-02-14\u0026skipToken=20", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97" ], + "x-ms-client-request-id": [ "26633a97-d3e6-4390-b53d-862118ee4722", "26633a97-d3e6-4390-b53d-862118ee4722", "26633a97-d3e6-4390-b53d-862118ee4722" ], + "CommandName": [ "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate", "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1", "Get-AzImageBuilderTemplate_List1" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T060638Z:a5fb3a96-deb1-4a70-adfb-57f371f06ce8" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11915" ], + "x-ms-correlation-request-id": [ "a5fb3a96-deb1-4a70-adfb-57f371f06ce8" ], + "x-ms-request-id": [ "0ebc75d9-7d75-447d-963f-ef5f3426ea7d" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:06:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "5734" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"value\": [\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-k28pym\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-z7ahdj\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T05:42:20.44856507Z\",\n \"endTime\": \"2020-05-11T05:42:22.684127604Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-z7ahdj\",\n \"name\": \"template-name-z7ahdj\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image\",\n \"type\": \"ManagedImage\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"managed img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-managedimg-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"run-managedimg-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T08:58:18.577793573Z\",\n \"endTime\": \"2020-04-24T09:15:14.011392171Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-managedimg-managedimg\",\n \"name\": \"tmpl-managedimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004080)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-platform-managed\",\n \"location\": \"eastus\",\n \"runOutputName\": \"out-platform-managed\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-27T08:10:00.96310846Z\",\n \"endTime\": \"2020-04-27T08:16:51.36540813Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-platform-managed\",\n \"name\": \"tmpl-platform-managed\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n },\n {\n \"properties\": {\n \"source\": {\n \"imageVersionId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/lucasimagegallery/images/myimagedefinition/versions/1.0.0\",\n \"type\": \"SharedImageVersion\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"test-linux-img\",\n \"disType\": \"shared img\",\n \"source\": \"azVmManagedImg\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/img-shareimg-managedimg\",\n \"location\": \"eastus\",\n \"runOutputName\": \"shareing-managedimg\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-04-24T10:04:55.922154854Z\",\n \"endTime\": \"2020-04-24T10:36:50.147714341Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/tmpl-shareimg-managedimg\",\n \"name\": \"tmpl-shareimg-managedimg\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n }\n ]\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..bb228cacfb0c --- /dev/null +++ b/src/ImageBuilder/test/Remove-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,27 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzImageBuilderTemplate' { + It 'Delete' { + Remove-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName13 -ResourceGroupName $env.ResourceGroup + $template = Get-AzImageBuilderTemplate -ResourceGroupName $env.ResourceGroup + $template.Name| Should -Not -Contain $env.Resources.Template.templateName13 + } + + It 'DeleteViaIdentity' { + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName16 -ResourceGroupName $env.ResourceGroup + Remove-AzImageBuilderTemplate -InputObject $template + $template = Get-AzImageBuilderTemplate -ResourceGroupName $env.ResourceGroup + $template.Name| Should -Not -Contain $env.Resources.Template.templateName16 + } +} diff --git a/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Recording.json b/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Recording.json new file mode 100644 index 000000000000..a4bc586158c3 --- /dev/null +++ b/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Recording.json @@ -0,0 +1,1135 @@ +{ + "Start-AzImageBuilderTemplate+[NoContext]+Run+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz/run?api-version=2020-02-14+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz/run?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "85405a3a-26a5-45f7-a568-2012a5031891" ], + "x-ms-request-id": [ "61f6254f-22b5-46fe-a8d1-fa14fb5498b2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063301Z:85405a3a-26a5-45f7-a568-2012a5031891" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:33:00 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11989" ], + "x-ms-correlation-request-id": [ "56d4e4dd-b225-4d94-9c13-339e0cb0cf8f" ], + "x-ms-request-id": [ "53054bb2-9938-480f-8bb7-3f98923092f8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063331Z:56d4e4dd-b225-4d94-9c13-339e0cb0cf8f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:33:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11988" ], + "x-ms-correlation-request-id": [ "9a370e50-be28-4445-97dd-e42999f714bc" ], + "x-ms-request-id": [ "1b4ac530-0094-424d-9c09-c99bca9d60c1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063402Z:9a370e50-be28-4445-97dd-e42999f714bc" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:34:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11987" ], + "x-ms-correlation-request-id": [ "76777704-b9a9-42c0-8e18-2d59e3a3c01f" ], + "x-ms-request-id": [ "7a319b3b-667b-42ec-bcf3-a326f91b8c9c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063432Z:76777704-b9a9-42c0-8e18-2d59e3a3c01f" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:34:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11986" ], + "x-ms-correlation-request-id": [ "2416c709-545f-46c8-bf1f-41c21f2f1f01" ], + "x-ms-request-id": [ "92ed42a2-75fd-4e75-b608-d14bf91508b9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063503Z:2416c709-545f-46c8-bf1f-41c21f2f1f01" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:35:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11985" ], + "x-ms-correlation-request-id": [ "7652f754-51ed-4c0c-a2ff-682b39d936c3" ], + "x-ms-request-id": [ "1e24c421-e3b3-4708-a8bb-a09980146f00" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063534Z:7652f754-51ed-4c0c-a2ff-682b39d936c3" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:35:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11984" ], + "x-ms-correlation-request-id": [ "5f5d58f6-7dae-4b9a-89f6-4db3f84546be" ], + "x-ms-request-id": [ "c802abc7-5de3-45b9-9695-b276e2a60a49" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063604Z:5f5d58f6-7dae-4b9a-89f6-4db3f84546be" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:36:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11983" ], + "x-ms-correlation-request-id": [ "6e707679-1806-42f9-b0ad-53f77d451f29" ], + "x-ms-request-id": [ "c4552f51-8b96-4176-8fe0-3c1b150bd19b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063634Z:6e707679-1806-42f9-b0ad-53f77d451f29" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:36:34 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11982" ], + "x-ms-correlation-request-id": [ "0ab48215-f2f4-4521-af2d-5e16873c971d" ], + "x-ms-request-id": [ "7c28f8d1-0195-4219-9ce0-b8c16295fea2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063706Z:0ab48215-f2f4-4521-af2d-5e16873c971d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:37:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11981" ], + "x-ms-correlation-request-id": [ "0289e4a6-52b1-4eab-98b1-f9384ab37fcc" ], + "x-ms-request-id": [ "f61d4933-ebc6-430a-82a2-3edd62721350" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063736Z:0289e4a6-52b1-4eab-98b1-f9384ab37fcc" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:37:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11980" ], + "x-ms-correlation-request-id": [ "72ebfb61-dc39-4048-b4b9-dc4b7b976bf8" ], + "x-ms-request-id": [ "d1ead752-e7e6-4dca-bf5f-77bf47c28d01" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063806Z:72ebfb61-dc39-4048-b4b9-dc4b7b976bf8" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:38:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11979" ], + "x-ms-correlation-request-id": [ "df7661ec-4146-4186-a553-8bf45f315715" ], + "x-ms-request-id": [ "600d2a2a-fd75-4a3f-b51f-da760eeecf7e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063837Z:df7661ec-4146-4186-a553-8bf45f315715" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:38:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11978" ], + "x-ms-correlation-request-id": [ "a036146f-221e-415b-af17-7c7630f8702b" ], + "x-ms-request-id": [ "3eaa9424-b8ab-401e-9209-419f49eac24c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063908Z:a036146f-221e-415b-af17-7c7630f8702b" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\",\n \"endTime\": \"2020-05-11T06:38:51.1693342Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/61f6254f-22b5-46fe-a8d1-fa14fb5498b2?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14" ], + "x-ms-client-request-id": [ "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1", "74d223da-f268-44ac-aaba-84d0e36d65b1" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run", "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11977" ], + "x-ms-correlation-request-id": [ "11d94886-d09e-4c09-9f22-82d0825a7d20" ], + "x-ms-request-id": [ "892dcaa5-3188-494e-92e7-0c1171699dde" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063908Z:11d94886-d09e-4c09-9f22-82d0825a7d20" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"61F6254F-22B5-46FE-A8D1-FA14FB5498B2\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:33:00.9257685Z\",\n \"endTime\": \"2020-05-11T06:38:51.1693342Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+Run+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "15" ], + "x-ms-client-request-id": [ "93abd6ad-c095-4da3-9f43-a2401dd836e6" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11976" ], + "x-ms-correlation-request-id": [ "0e376643-6795-4289-8b1f-301aa72ba735" ], + "x-ms-request-id": [ "254bb35b-1e34-4551-8375-b2a5f8f1b7f6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063909Z:0e376643-6795-4289-8b1f-301aa72ba735" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1265" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:33:00.821820972Z\",\n \"endTime\": \"2020-05-11T06:38:50.984875048Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "16" ], + "x-ms-client-request-id": [ "61e98f00-b835-417d-8fe7-b5d3470f06b1" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11975" ], + "x-ms-correlation-request-id": [ "fa657a66-96ea-46c4-ae71-493c58a5bda5" ], + "x-ms-request-id": [ "7c336c4e-6c23-42c4-a1cf-02000c23ad79" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063909Z:fa657a66-96ea-46c4-ae71-493c58a5bda5" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1265" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:33:00.821820972Z\",\n \"endTime\": \"2020-05-11T06:38:50.984875048Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz/run?api-version=2020-02-14+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz/run?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "40665cfb-6757-43f0-b385-d0f28de46cf4" ], + "x-ms-request-id": [ "30f26052-ba9b-4549-9b70-d26da8cb4213" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063910Z:40665cfb-6757-43f0-b385-d0f28de46cf4" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:10 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "x-ms-correlation-request-id": [ "167db421-82b6-43b5-bb7a-63d20c315913" ], + "x-ms-request-id": [ "ad878901-5bb5-4f55-b546-6aa143ed1f97" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T063941Z:167db421-82b6-43b5-bb7a-63d20c315913" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:39:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11974" ], + "x-ms-correlation-request-id": [ "8ba58b39-f28e-479e-b883-e490203db95b" ], + "x-ms-request-id": [ "35aa9e0c-cd6d-4fc9-afe4-aca5091447c0" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064011Z:8ba58b39-f28e-479e-b883-e490203db95b" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:40:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11973" ], + "x-ms-correlation-request-id": [ "9862012a-6486-4191-9936-f4c44179b0f0" ], + "x-ms-request-id": [ "0c9b1b35-5f14-4ede-a4e7-581186e9eb09" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064041Z:9862012a-6486-4191-9936-f4c44179b0f0" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:40:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11972" ], + "x-ms-correlation-request-id": [ "fdd5136c-13b7-436e-bb21-31487aca12f2" ], + "x-ms-request-id": [ "00ef82d4-1c79-4f0f-8fac-3b3b7f6630ed" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064113Z:fdd5136c-13b7-436e-bb21-31487aca12f2" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:41:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11971" ], + "x-ms-correlation-request-id": [ "e1e199b9-db7e-4a82-abd5-8d1ad47cf29d" ], + "x-ms-request-id": [ "dad327b3-3c83-471f-9fec-cd834511dcaf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064143Z:e1e199b9-db7e-4a82-abd5-8d1ad47cf29d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:41:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11970" ], + "x-ms-correlation-request-id": [ "7bbfa4a3-6788-4ca0-9e0d-c1c42a44420d" ], + "x-ms-request-id": [ "ef245e39-12a8-413d-a711-37b933fc41a1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064213Z:7bbfa4a3-6788-4ca0-9e0d-c1c42a44420d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:42:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23", "24" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11969" ], + "x-ms-correlation-request-id": [ "55041391-fcca-4081-a50c-02da2679571c" ], + "x-ms-request-id": [ "323ace04-8ec5-4740-beca-fed88faac56e" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064244Z:55041391-fcca-4081-a50c-02da2679571c" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:42:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23", "24", "25" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11968" ], + "x-ms-correlation-request-id": [ "cf3ef549-7654-4755-8194-1303813820fe" ], + "x-ms-request-id": [ "49020ad4-ac64-4ac5-a3f5-4fde80fe7f41" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064315Z:cf3ef549-7654-4755-8194-1303813820fe" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:43:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23", "24", "25", "26" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11967" ], + "x-ms-correlation-request-id": [ "2572b58b-bbd2-4487-ba97-4605427027f6" ], + "x-ms-request-id": [ "19577b18-7ed5-42cd-91b0-728f8b32db3b" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064345Z:2572b58b-bbd2-4487-ba97-4605427027f6" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:43:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"InProgress\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11966" ], + "x-ms-correlation-request-id": [ "bd9d6d28-8d8d-44b7-85d5-d832be3ae7ab" ], + "x-ms-request-id": [ "806eb7f4-ee7c-4447-aae1-5e3ac1ac915c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064416Z:bd9d6d28-8d8d-44b7-85d5-d832be3ae7ab" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:44:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\",\n \"endTime\": \"2020-05-11T06:44:10.9671114Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/30f26052-ba9b-4549-9b70-d26da8cb4213?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28" ], + "x-ms-client-request-id": [ "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d", "47161564-3559-47a2-9053-0cbc167c225d" ], + "CommandName": [ "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate", "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity", "Start-AzImageBuilderTemplate_RunViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11965" ], + "x-ms-correlation-request-id": [ "4de499ef-c37a-4a79-8ebb-e36689b5621c" ], + "x-ms-request-id": [ "d08e5d5b-404f-415c-a54a-23425a1d7daf" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064416Z:4de499ef-c37a-4a79-8ebb-e36689b5621c" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:44:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "165" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"name\": \"30F26052-BA9B-4549-9B70-D26DA8CB4213\",\n \"status\": \"Succeeded\",\n \"startTime\": \"2020-05-11T06:39:10.3654606Z\",\n \"endTime\": \"2020-05-11T06:44:10.9671114Z\"\n}" + } + }, + "Start-AzImageBuilderTemplate+[NoContext]+RunViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "f3c2051a-89e3-49cb-95d8-27be18c1fce7" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11964" ], + "x-ms-correlation-request-id": [ "94a50abd-c12a-4821-8e76-2370f4a411e7" ], + "x-ms-request-id": [ "709a8dfd-d6d5-4ea1-92c2-b995fdd641f1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T064417Z:94a50abd-c12a-4821-8e76-2370f4a411e7" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:44:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1264" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"distribute\": [\n {\n \"artifactTags\": {\n \"tag\": \"VHD\"\n },\n \"runOutputName\": \"runout-template-name-1k8btz\",\n \"type\": \"VHD\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:39:10.251681218Z\",\n \"endTime\": \"2020-05-11T06:44:10.79672437Z\",\n \"runState\": \"Succeeded\",\n \"message\": \"\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-1k8btz\",\n \"name\": \"template-name-1k8btz\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..73dffcadb985 --- /dev/null +++ b/src/ImageBuilder/test/Start-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,27 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Start-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Start-AzImageBuilderTemplate' { + It 'Run' { + Start-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup + $template.LastRunStatus.RunState | Should -Be 'Succeeded' + } + + It 'RunViaIdentity' { + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup + Start-AzImageBuilderTemplate -InputObject $template + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName12 -ResourceGroupName $env.ResourceGroup + $template.LastRunStatus.RunState | Should -Be 'Succeeded' + } +} diff --git a/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Recording.json b/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Recording.json new file mode 100644 index 000000000000..7fc16670827c --- /dev/null +++ b/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Recording.json @@ -0,0 +1,312 @@ +{ + "Stop-AzImageBuilderTemplate+[NoContext]+Cancel+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "2" ], + "x-ms-client-request-id": [ "1b4ca4d0-e743-4f12-97e8-97b034feb788" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "bb80ef94-b971-4302-82bd-0194c412cbec" ], + "x-ms-request-id": [ "3c59d4c6-526b-4c36-992d-e24d99e83810" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062706Z:bb80ef94-b971-4302-82bd-0194c412cbec" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1834" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:21:02.405858224Z\",\n \"endTime\": \"2020-05-11T06:23:41.371905753Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+Cancel+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/run?api-version=2020-02-14+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/run?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "1" ], + "x-ms-client-request-id": [ "539b922b-960d-4e9c-9195-61db156676ee" ], + "CommandName": [ "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/34859459-9dfc-4698-b2da-3a8311f15d2a?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/34859459-9dfc-4698-b2da-3a8311f15d2a?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "8b753d14-8267-4c69-8969-680d6009b387" ], + "x-ms-request-id": [ "34859459-9dfc-4698-b2da-3a8311f15d2a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062706Z:8b753d14-8267-4c69-8969-680d6009b387" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:06 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+Cancel+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/cancel?api-version=2020-02-14+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul/cancel?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "3" ], + "x-ms-client-request-id": [ "0bf727fe-efdd-4188-802f-f3198d263b49" ], + "CommandName": [ "Stop-AzImageBuilderTemplate" ], + "FullCommandName": [ "Stop-AzImageBuilderTemplate_Cancel" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-correlation-request-id": [ "1b129815-22b8-4251-9b08-5f44251bcf5d" ], + "x-ms-request-id": [ "04aa2819-84e3-482e-a87b-0496c8b018e7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062707Z:1b129815-22b8-4251-9b08-5f44251bcf5d" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:06 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+Cancel+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "4" ], + "x-ms-client-request-id": [ "c6e8fd6f-cb76-44c2-b7ed-216c3a4177ce" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11997" ], + "x-ms-correlation-request-id": [ "9af3cfeb-e4af-4092-89b8-4832bbc51614" ], + "x-ms-request-id": [ "f76e50d5-da81-4e08-a203-28505fcd41c6" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062707Z:9af3cfeb-e4af-4092-89b8-4832bbc51614" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1824" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"platforimage\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-kmprul\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:27:06.441334288Z\",\n \"endTime\": \"0001-01-01T00:00:00Z\",\n \"runState\": \"Canceling\",\n \"message\": \"Canceling image build\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-kmprul\",\n \"name\": \"template-name-kmprul\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+CancelViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "6" ], + "x-ms-client-request-id": [ "a6fa5f78-12c8-46ec-8c0f-0f0667a2aa0c" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11996" ], + "x-ms-correlation-request-id": [ "ea958623-9197-4c17-bf53-90af55c66292" ], + "x-ms-request-id": [ "2bc5571c-2c64-4186-87d9-c33cf6be997f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062708Z:ea958623-9197-4c17-bf53-90af55c66292" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1834" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:23:39.484158945Z\",\n \"endTime\": \"2020-05-11T06:23:42.874161415Z\",\n \"runState\": \"Canceled\",\n \"message\": \"The build was canceled\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+CancelViaIdentity+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e/run?api-version=2020-02-14+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e/run?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "5" ], + "x-ms-client-request-id": [ "5329721b-729c-4919-bdf6-4d717154658c" ], + "CommandName": [ "Start-AzImageBuilderTemplate" ], + "FullCommandName": [ "Start-AzImageBuilderTemplate_Run" ], + "ParameterSetName": [ "" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/bfd68cec-fef2-4ffb-874f-803b9a1b4545?api-version=2020-02-14" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "azure-asyncoperation": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.VirtualMachineImages/locations/eastus/operations/bfd68cec-fef2-4ffb-874f-803b9a1b4545?api-version=2020-02-14" ], + "x-ms-correlation-request-id": [ "4fd2533f-2409-4d55-958d-67b0e1678f48" ], + "x-ms-request-id": [ "bfd68cec-fef2-4ffb-874f-803b9a1b4545" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062708Z:4fd2533f-2409-4d55-958d-67b0e1678f48" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:08 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+CancelViaIdentity+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e/cancel?api-version=2020-02-14+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e/cancel?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "7" ], + "x-ms-client-request-id": [ "af95b641-2bbd-4ac6-9f53-b5e74c385648" ], + "CommandName": [ "Stop-AzImageBuilderTemplate" ], + "FullCommandName": [ "Stop-AzImageBuilderTemplate_CancelViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "x-ms-correlation-request-id": [ "f4186e24-4acc-496f-a19a-45116d83e278" ], + "x-ms-request-id": [ "65643bd3-a182-4b46-b087-84c393976bb2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062708Z:f4186e24-4acc-496f-a19a-45116d83e278" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:08 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Stop-AzImageBuilderTemplate+[NoContext]+CancelViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e?api-version=2020-02-14", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "8" ], + "x-ms-client-request-id": [ "58d59c7c-aef2-4b3a-859c-f6878e04cbed" ], + "CommandName": [ "Get-AzImageBuilderTemplate" ], + "FullCommandName": [ "Get-AzImageBuilderTemplate_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11995" ], + "x-ms-correlation-request-id": [ "f28dc6da-305c-4dd7-b77d-fbb902701326" ], + "x-ms-request-id": [ "bfccf4f4-f178-407a-ac11-cafb55759fbc" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "nginx" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200511T062709Z:f28dc6da-305c-4dd7-b77d-fbb902701326" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Mon, 11 May 2020 06:27:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1824" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\n \"properties\": {\n \"source\": {\n \"offer\": \"UbuntuServer\",\n \"publisher\": \"Canonical\",\n \"sku\": \"18.04-LTS\",\n \"type\": \"PlatformImage\",\n \"version\": \"latest (18.04.202004290)\"\n },\n \"customize\": [\n {\n \"name\": \"downloadBuildArtifacts\",\n \"scriptUri\": \"https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh\",\n \"sha256Checksum\": \"ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93\",\n \"type\": \"Shell\"\n }\n ],\n \"distribute\": [\n {\n \"artifactTags\": {\n \"baseofimg\": \"UbuntuServer\",\n \"source\": \"azVmPlatform\"\n },\n \"imageId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-ewrnab\",\n \"location\": \"eastus\",\n \"runOutputName\": \"runout-template-name-wdqr9e\",\n \"type\": \"ManagedImage\"\n }\n ],\n \"provisioningState\": \"Succeeded\",\n \"lastRunStatus\": {\n \"startTime\": \"2020-05-11T06:27:08.193191136Z\",\n \"endTime\": \"0001-01-01T00:00:00Z\",\n \"runState\": \"Canceling\",\n \"message\": \"Canceling image build\"\n },\n \"buildTimeoutInMinutes\": 0\n },\n \"identity\": {\n \"type\": \"UserAssigned\",\n \"userAssignedIdentities\": {\n \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity\": {\n \"principalId\": \"f0b66e88-96a1-4f5a-a177-b05a26f15a34\",\n \"clientId\": \"700b80f5-e54f-4951-a836-e7c5fc28e482\"\n }\n }\n },\n \"id\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.VirtualMachineImages/imageTemplates/template-name-wdqr9e\",\n \"name\": \"template-name-wdqr9e\",\n \"type\": \"Microsoft.VirtualMachineImages/imageTemplates\",\n \"location\": \"eastus\",\n \"tags\": {}\n}" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..3c6718aeab7b --- /dev/null +++ b/src/ImageBuilder/test/Stop-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Stop-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Stop-AzImageBuilderTemplate' { + It 'Cancel' { + Start-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup -NoWait + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + Stop-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $template.LastRunStatusRunState | Should -Be 'Canceling' + } + + It 'CancelViaIdentity' { + Start-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName11 -ResourceGroupName $env.ResourceGroup -NoWait + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName11 -ResourceGroupName $env.ResourceGroup + Stop-AzImageBuilderTemplate -InputObject $template + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName11 -ResourceGroupName $env.ResourceGroup + $template.LastRunStatusRunState | Should -Be 'Canceling' + } +} diff --git a/src/ImageBuilder/test/Update-AzImageBuilderTemplate.Tests.ps1 b/src/ImageBuilder/test/Update-AzImageBuilderTemplate.Tests.ps1 new file mode 100644 index 000000000000..f405129a5416 --- /dev/null +++ b/src/ImageBuilder/test/Update-AzImageBuilderTemplate.Tests.ps1 @@ -0,0 +1,38 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzImageBuilderTemplate' { + It 'Name' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateExpanded1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'Update1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'InputObject' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentityExpanded1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } + + It 'UpdateViaIdentity1' -skip { + { throw [System.NotImplementedException] } | Should -Not -Throw + } +} diff --git a/src/ImageBuilder/test/Update-AzImageBuilderTemplate.skip.ps1 b/src/ImageBuilder/test/Update-AzImageBuilderTemplate.skip.ps1 new file mode 100644 index 000000000000..74f08b535d5a --- /dev/null +++ b/src/ImageBuilder/test/Update-AzImageBuilderTemplate.skip.ps1 @@ -0,0 +1,42 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzImageBuilderTemplate.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzImageBuilderTemplate' { + It 'Name'-skip { + $tag = @{key = 'Name'} + } + + It 'UpdateExpanded' -skip { + $tag = @{key = 'UpdateExpanded'} + } + + It 'Update' -skip { + $tag = @{key = 'Update'} + } + + It 'InputObject' { + $tag = @{key = 'InputObject'} + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + Update-AzImageBuilderTemplate -InputObject $template -Tag $tag + $template = Get-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -ResourceGroupName $env.ResourceGroup + $template.Tag.Item("info") | Should -Be $tag.key + } + + It 'UpdateViaIdentityExpanded' -skip { + $tag = @{key = 'UpdateViaIdentityExpanded'} + } + + It 'UpdateViaIdentity' -skip { + $tag = @{key = 'UpdateViaIdentity'} + } +} diff --git a/src/ImageBuilder/test/deployment-templates/managed-image/parameters.json b/src/ImageBuilder/test/deployment-templates/managed-image/parameters.json new file mode 100644 index 000000000000..88d1cd95d062 --- /dev/null +++ b/src/ImageBuilder/test/deployment-templates/managed-image/parameters.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "images_test_linux_image_name": { + "value": "managed-image-linux" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/deployment-templates/managed-image/template.json b/src/ImageBuilder/test/deployment-templates/managed-image/template.json new file mode 100644 index 000000000000..2accc8adc6be --- /dev/null +++ b/src/ImageBuilder/test/deployment-templates/managed-image/template.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "images_test_linux_image_name": { + "defaultValue": "test-linux-image", + "type": "String" + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Compute/images", + "apiVersion": "2019-07-01", + "name": "[parameters('images_test_linux_image_name')]", + "location": "eastus", + "tags": { + "baseosimg": "ubuntu1804", + "source": "azVmImageBuilder" + }, + "properties": { + "storageProfile": { + "osDisk": { + "osType": "Linux", + "osState": "Generalized", + "diskSizeGB": 30, + "blobUri": "https://32rngewd8ofquuqtml5ggf2o.blob.core.windows.net/vhds/c1199f18-3121-4541-964c-80cee24a45c8.vhd", + "caching": "None", + "storageAccountType": "Standard_LRS" + }, + "dataDisks": [] + }, + "hyperVGeneration": "V1" + } + } + ] +} \ No newline at end of file diff --git a/src/ImageBuilder/test/deployment-templates/shared-image/parameters.json b/src/ImageBuilder/test/deployment-templates/shared-image/parameters.json new file mode 100644 index 000000000000..79cf37cb83a4 --- /dev/null +++ b/src/ImageBuilder/test/deployment-templates/shared-image/parameters.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "galleries_testsharedgallery_name": { + "value": "sharedgallery" + }, + "images_test_linux_image_externalid": { + "value": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/WYUNCHI-IMAGEBUILDER/providers/Microsoft.Compute/images/image_managed_linux" + } + } +} \ No newline at end of file diff --git a/src/ImageBuilder/test/deployment-templates/shared-image/template.json b/src/ImageBuilder/test/deployment-templates/shared-image/template.json new file mode 100644 index 000000000000..8345d5290bd0 --- /dev/null +++ b/src/ImageBuilder/test/deployment-templates/shared-image/template.json @@ -0,0 +1,88 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "galleries_testsharedgallery_name": { + "defaultValue": "testsharedgallery", + "type": "String" + }, + "images_test_linux_image_externalid": { + "defaultValue": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/WYUNCHI-IMAGEBUILDER/providers/Microsoft.Compute/images/test-linux-image", + "type": "String" + } + }, + "variables": {}, + "resources": [ + { + "type": "Microsoft.Compute/galleries", + "apiVersion": "2019-03-01", + "name": "[parameters('galleries_testsharedgallery_name')]", + "location": "eastus", + "tags": { + "type": "test" + }, + "properties": { + "identifier": { + "uniqueName": "9e223dbe-3399-4e19-88eb-0975f02ac87f-TESTSHAREDGALLERY" + } + } + }, + { + "type": "Microsoft.Compute/galleries/images", + "apiVersion": "2019-03-01", + "name": "[concat(parameters('galleries_testsharedgallery_name'), '/imagedefinition-linux')]", + "location": "eastus", + "dependsOn": [ + "[resourceId('Microsoft.Compute/galleries', parameters('galleries_testsharedgallery_name'))]" + ], + "properties": { + "osType": "Linux", + "osState": "Generalized", + "identifier": { + "publisher": "test", + "offer": "test", + "sku": "Linux-Gen1" + }, + "recommended": { + "vCPUs": { + "min": 16, + "max": 64 + }, + "memory": { + "min": 500, + "max": 1024 + } + } + } + }, + { + "type": "Microsoft.Compute/galleries/images/versions", + "apiVersion": "2019-03-01", + "name": "[concat(parameters('galleries_testsharedgallery_name'), '/imagedefinition-linux/1.0.0')]", + "location": "eastus", + "dependsOn": [ + "[resourceId('Microsoft.Compute/galleries/images', parameters('galleries_testsharedgallery_name'), 'imagedefinition-linux')]", + "[resourceId('Microsoft.Compute/galleries', parameters('galleries_testsharedgallery_name'))]" + ], + "properties": { + "publishingProfile": { + "source": { + "managedImage": { + "id": "[parameters('images_test_linux_image_externalid')]" + } + }, + "targetRegions": [ + { + "name": "East US", + "regionalReplicaCount": 1, + "storageAccountType": "Standard_LRS" + } + ], + "replicaCount": 1, + "excludeFromLatest": false, + "storageAccountType": "Standard_LRS" + } + } + } + ] +} \ No newline at end of file diff --git a/src/ImageBuilder/test/env.json b/src/ImageBuilder/test/env.json new file mode 100644 index 000000000000..626f4faf81df --- /dev/null +++ b/src/ImageBuilder/test/env.json @@ -0,0 +1,87 @@ +{ + "RepLocation": "eastus2", + "Location": "eastus", + "Resources": { + "Template": { + "templateName101": "template-name-ij2xlw", + "templateName103": "template-name-32uiab", + "templateName19": "template-name-k2fhvz", + "templateName11": "template-name-wdqr9e", + "templateName16": "template-name-knv6ey", + "templateName17": "template-name-i6romg", + "templateName15": "template-name-2aji6b", + "templateName10": "template-name-kmprul", + "templateName12": "template-name-1k8btz", + "templateName100": "template-name-bivfom", + "templateName18": "template-name-ktxvh6", + "templateName13": "template-name-mdak42", + "templateName102": "template-name-2vbuwz", + "templateName14": "template-name-suq1dv" + }, + "Customizer": { + "customizerName30": "customizer-name-ht4dkz" + }, + "RunOutputName": { + "runOutputName200": "runout-template-name-bivfom", + "runOutputName25": "runout-template-name-2aji6b", + "runOutputName20": "runout-template-name-kmprul", + "runOutputName27": "runout-template-name-i6romg", + "runOutputName21": "runout-template-name-wdqr9e", + "runOutputName22": "runout-template-name-1k8btz", + "runOutputName202": "runout-template-name-2vbuwz", + "runOutputName26": "runout-template-name-knv6ey", + "runOutputName23": "runout-template-name-mdak42", + "runOutputName28": "runout-template-name-ktxvh6", + "runOutputName201": "runout-template-name-ij2xlw", + "runOutputName203": "runout-template-name-32uiab", + "runOutputName24": "runout-template-name-suq1dv", + "runOutputName29": "runout-template-name-k2fhvz" + }, + "Distributor": { + "distributorName001": "dis-img-8ibsuk", + "distributorName05": "dis-img-09r5dg", + "distributorName07": "dis-img-xqmc4s", + "distributorName04": "dis-img-2ecfok", + "distributorName09": "dis-img-qkn61a", + "distributorName002": "dis-img-dg7eky", + "distributorName08": "dis-img-8w7o9q", + "distributorName03": "dis-img-q9vpxe", + "distributorName000": "dis-img-in2rcd", + "distributorName06": "dis-img-j7ctg0", + "distributorName01": "dis-img-ewrnab", + "distributorName02": "dis-img-3291uc", + "distributorName00": "dis-img-rzycxw", + "distributorName003": "dis-img-7tz8iv" + } + }, + "Source": { + "PlatformImageLinux": { + "sku": "18.04-LTS", + "version": "latest", + "offer": "UbuntuServer", + "publisher": "Canonical" + }, + "SharedImageLinux": { + "imageVersionId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0" + }, + "PlatformImageWind": {}, + "ManagedImageWind": {}, + "ManagedImageLinux": { + "imageId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/test-linux-image" + }, + "SharedImageWind": {} + }, + "ResourceGroup": "wyunchi-imagebuilder", + "userAssignedIdentity": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "Distributor": { + "SharedImageLinux": { + "galleryImageId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share" + }, + "VHD": {}, + "ManagedImageLinux": { + "imageId": "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/wyunchi-imagebuilder/providers/Microsoft.Compute/images/dis-img-rzycxw" + } + }, + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f" +} diff --git a/src/ImageBuilder/test/loadEnv.ps1 b/src/ImageBuilder/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/ImageBuilder/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/ImageBuilder/test/readme.md b/src/ImageBuilder/test/readme.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/ImageBuilder/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/ImageBuilder/test/utils.ps1 b/src/ImageBuilder/test/utils.ps1 new file mode 100644 index 000000000000..52aba70113a3 --- /dev/null +++ b/src/ImageBuilder/test/utils.ps1 @@ -0,0 +1,161 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + $env.ResourceGroup = 'wyunchi-imagebuilder' + $env.Location = 'eastus' + $env.RepLocation = 'eastus2' + + #Generate some strings for use in the test. + $env.Resources = @{Distributor= @{}; Template=@{}; RunOutputName=@{}; Customizer=@{}} + + $distributorName00 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName01 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName02 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName03 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName04 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName05 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName06 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName07 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName08 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName09 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName000 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName001 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName002 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName003 = 'dis-img-' + (RandomString -allChars $false -len 6) + $distributorName004 = 'dis-img-' + (RandomString -allChars $false -len 6) + $env.Resources.Distributor.Add('distributorName00', $distributorName00); + $env.Resources.Distributor.Add('distributorName01', $distributorName01); + $env.Resources.Distributor.Add('distributorName02', $distributorName02); + $env.Resources.Distributor.Add('distributorName03', $distributorName03); + $env.Resources.Distributor.Add('distributorName04', $distributorName04); + $env.Resources.Distributor.Add('distributorName05', $distributorName05); + $env.Resources.Distributor.Add('distributorName06', $distributorName06); + $env.Resources.Distributor.Add('distributorName07', $distributorName07); + $env.Resources.Distributor.Add('distributorName08', $distributorName08); + $env.Resources.Distributor.Add('distributorName09', $distributorName09); + $env.Resources.Distributor.Add('distributorName000', $distributorName000); + $env.Resources.Distributor.Add('distributorName001', $distributorName001); + $env.Resources.Distributor.Add('distributorName002', $distributorName002); + $env.Resources.Distributor.Add('distributorName003', $distributorName003); + + $templateName10 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName11 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName12 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName13 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName14 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName15 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName16 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName17 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName18 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName19 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName100 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName101 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName102 = 'template-name-' + (RandomString -allChars $false -len 6) + $templateName103 = 'template-name-' + (RandomString -allChars $false -len 6) + $env.Resources.Template.Add('templateName10', $templateName10); + $env.Resources.Template.Add('templateName11', $templateName11); + $env.Resources.Template.Add('templateName12', $templateName12); + $env.Resources.Template.Add('templateName13', $templateName13); + $env.Resources.Template.Add('templateName14', $templateName14); + $env.Resources.Template.Add('templateName15', $templateName15); + $env.Resources.Template.Add('templateName16', $templateName16); + $env.Resources.Template.Add('templateName17', $templateName17); + $env.Resources.Template.Add('templateName18', $templateName18); + $env.Resources.Template.Add('templateName19', $templateName19); + $env.Resources.Template.Add('templateName100', $templateName100); + $env.Resources.Template.Add('templateName101', $templateName101); + $env.Resources.Template.Add('templateName102', $templateName102); + $env.Resources.Template.Add('templateName103', $templateName103); + + $runOutputName20 = 'runout-' + $templateName10 + $runOutputName21 = 'runout-' + $templateName11 + $runOutputName22 = 'runout-' + $templateName12 + $runOutputName23 = 'runout-' + $templateName13 + $runOutputName24 = 'runout-' + $templateName14 + $runOutputName25 = 'runout-' + $templateName15 + $runOutputName26 = 'runout-' + $templateName16 + $runOutputName27 = 'runout-' + $templateName17 + $runOutputName28 = 'runout-' + $templateName18 + $runOutputName29 = 'runout-' + $templateName19 + $runOutputName200 = 'runout-' + $templateName100 + $runOutputName201 = 'runout-' + $templateName101 + $runOutputName202 = 'runout-' + $templateName102 + $runOutputName203 = 'runout-' + $templateName103 + $env.Resources.RunOutputName.Add('runOutputName20', $runOutputName20); + $env.Resources.RunOutputName.Add('runOutputName21', $runOutputName21); + $env.Resources.RunOutputName.Add('runOutputName22', $runOutputName22); + $env.Resources.RunOutputName.Add('runOutputName23', $runOutputName23); + $env.Resources.RunOutputName.Add('runOutputName24', $runOutputName24); + $env.Resources.RunOutputName.Add('runOutputName25', $runOutputName25); + $env.Resources.RunOutputName.Add('runOutputName26', $runOutputName26); + $env.Resources.RunOutputName.Add('runOutputName27', $runOutputName27); + $env.Resources.RunOutputName.Add('runOutputName28', $runOutputName28); + $env.Resources.RunOutputName.Add('runOutputName29', $runOutputName29); + $env.Resources.RunOutputName.Add('runOutputName200', $runOutputName200); + $env.Resources.RunOutputName.Add('runOutputName201', $runOutputName201); + $env.Resources.RunOutputName.Add('runOutputName202', $runOutputName202); + $env.Resources.RunOutputName.Add('runOutputName203', $runOutputName203); + + + # Deploy resource for test. + # Deploy image + <# + Write-Host -ForegroundColor Green "Start deploying resource for test..." + New-AzDeployment -Mode Incremental -TemplateFile .\test\deployment-templates\managed-image\template.json -TemplateParameterFile .\test\deployment-templates\managed-image\parameters.json -ResourceGroupName $env.ResourceGroup + # Failed: The source blob https://32rngewd8ofquuqtml5ggf2o.blob.core.windows.net/vhds/ffee76c3-a79b-43ae-a207-4fa9ee5e221a.vhd was not found. + Write-Host -ForegroundColor Green "Successfully deployed resources." + #> + #$UserAssignedIdentity = Get-AzUserAssignedIdentity -ResourceGroupName $env.ResourceGroup -Name image-builder-user-assign-identity + + $env.userAssignedIdentity = "/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/wyunchi-imagebuilder/providers/Microsoft.ManagedIdentity/userAssignedIdentities/image-builder-user-assign-identity" + + $customizerName30 = 'customizer-name-' + (RandomString -allChars $false -len 6) + $env.Resources.Customizer.Add('customizerName30', $customizerName30); + + # For any resources you created for test, you should add it to $env here. + $env.Source = @{PlatformImageLinux=@{};PlatformImageWind=@{};ManagedImageLinux=@{}; ManagedImageWind=@{}; SharedImageLinux=@{};SharedImageWind=@{}} + $env.Source.PlatformImageLinux = @{publisher = 'Canonical';offer = 'UbuntuServer';sku = '18.04-LTS';version = 'latest'}; + $env.Source.ManagedImageLinux = @{imageId="/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/test-linux-image"} + $env.Source.SharedImageLinux = @{ imageVersionId= "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/testsharedgallery/images/imagedefinition-linux/versions/1.0.0"} + + $env.Distributor = @{VHD = @{};ManagedImageLinux=@{}; SharedImageLinux=@{}} + $env.Distributor.VHD = @{} + $env.Distributor.ManagedImageLinux = @{imageId = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/images/$($env.Resources.Distributor.distributorName00)"} + $env.Distributor.SharedImageLinux = @{galleryImageId = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.ResourceGroup)/providers/Microsoft.Compute/galleries/myimagegallery/images/lcuas-linux-share"} + + Write-Host -ForegroundColor Green "Start creating template image for test..." + $srcPlatform = New-AzImageBuilderSourceObject -SourceTypePlatformImage -Publisher $env.Source.PlatformImageLinux.publisher -Offer $env.Source.PlatformImageLinux.offer -Sku $env.Source.PlatformImageLinux.sku -Version $env.Source.PlatformImageLinux.version #-PlanName $null -PlanProduct $null -PlanPublisher $null + $distributor = New-AzImageBuilderDistributorObject -ManagedImageDistributor -ArtifactTag @{source='platforimage';baseofimg='UbuntuServer'} -ImageId $env.Distributor.ManagedImageLinux.imageId -Location $env.Location -RunOutputName $env.Resources.RunOutputName.runOutputName20 + $customizerName = 'downloadBuildArtifacts' + $sha256Checksum = 'ade4c5214c3c675e92c66e2d067a870c5b81b9844b3de3cc72c49ff36425fc93' + $sourceUri = 'https://raw.githubusercontent.com/danielsollondon/azvmimagebuilder/master/quickquickstarts/customizeScript2.sh' + $customizer = New-AzImageBuilderCustomizerObject -ShellCustomizer -CustomizerName $customizerName -ScriptUri $sourceUri -Sha256Checksum $sha256Checksum + + $tmplPlatformManaged = New-AzImageBuilderTemplate -ImageTemplateName $env.Resources.Template.templateName10 -Source $srcPlatform -Distribute $distributor -Customize $customizer -ResourceGroupName $env.ResourceGroup -Location $env.Location -UserAssignedIdentityId $env.userAssignedIdentity + Write-Host -ForegroundColor Green "Successfully created templeate image." + + Write-Host -ForegroundColor Green "Start $($env.Resources.Template.templateName10) template image for test." + Start-AzImageBuilderTemplate -ResourceGroupName $env.ResourceGroup -ImageTemplateName $env.Resources.Template.templateName10 + Write-Host -ForegroundColor Green "Successfully started templeate image." + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing + Get-AzImageBuilderTemplate -ResourceGroupName $env.ResourceGroup | Where-Object {$_.Name -Match '^template*'} | Remove-AzImageBuilderTemplate +} + diff --git a/src/ImportExport/Az.ImportExport.format.ps1xml b/src/ImportExport/Az.ImportExport.format.ps1xml new file mode 100644 index 000000000000..b250412e7e58 --- /dev/null +++ b/src/ImportExport/Az.ImportExport.format.ps1xml @@ -0,0 +1,841 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.ImportExportIdentity + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.ImportExportIdentity + + + + + + + + + + + + + + + + + + + + + JobName + + + LocationName + + + ResourceGroupName + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveBitLockerKey + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveBitLockerKey + + + + + + + + + + + + + + + BitLockerKey + + + DriveId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BitLockerKey + + + BytesSucceeded + + + CopyStatus + + + DriveHeaderHash + + + DriveId + + + ErrorLogUri + + + ManifestFile + + + ManifestHash + + + ManifestUri + + + PercentComplete + + + State + + + VerboseLogUri + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseError + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseError + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItem + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItem + + + + + + + + + + + + + + + + + + Code + + + Message + + + Target + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Export + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Export + + + + + + + + + + + + BlobListblobPath + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobList + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobList + + + + + + + + + + + + + + + BlobPath + + + BlobPathPrefix + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + BackupDriveManifest + + + CancelRequested + + + DiagnosticsPath + + + IncompleteBlobListUri + + + JobType + + + LogLevel + + + PercentComplete + + + ProvisioningState + + + State + + + StorageAccountId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse + + + + + + + + + + + + + + + + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ListJobsResponse + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ListJobsResponse + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Location + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Location + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationProperties + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AlternateLocation + + + City + + + CountryOrRegion + + + Phone + + + PostalCode + + + RecipientName + + + StateOrProvince + + + StreetAddress1 + + + StreetAddress2 + + + SupportedCarrier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Operation + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Operation + + + + + + + + + + + + Name + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplay + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation + + + + + + + + + + + + + + + + + + + + + CarrierName + + + DriveCount + + + ShipDate + + + TrackingNumber + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParameters + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParameters + + + + + + + + + + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + City + + + CountryOrRegion + + + Email + + + Phone + + + PostalCode + + + RecipientName + + + StateOrProvince + + + StreetAddress1 + + + StreetAddress2 + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping + + + + + + + + + + + + + + + CarrierAccountNumber + + + CarrierName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformation + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + City + + + CountryOrRegion + + + Phone + + + PostalCode + + + RecipientName + + + StateOrProvince + + + StreetAddress1 + + + StreetAddress2 + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersProperties + + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersProperties + + + + + + + + + + + + + + + + + + + + + BackupDriveManifest + + + CancelRequested + + + LogLevel + + + State + + + + + + + + \ No newline at end of file diff --git a/src/ImportExport/Az.ImportExport.psd1 b/src/ImportExport/Az.ImportExport.psd1 new file mode 100644 index 000000000000..cfd94bd604ad --- /dev/null +++ b/src/ImportExport/Az.ImportExport.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = '47cfc32b-a3bc-46e1-935e-11a63032bb86' + RootModule = './Az.ImportExport.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: ImportExport cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.ImportExport.private.dll' + FormatsToProcess = './Az.ImportExport.format.ps1xml' + FunctionsToExport = 'Get-AzImportExport', 'Get-AzImportExportBitLockerKey', 'Get-AzImportExportLocation', 'New-AzImportExport', 'New-AzImportExportDriveListObject', 'Remove-AzImportExport', 'Update-AzImportExport', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'ImportExport' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/ImportExport/Az.ImportExport.psm1 b/src/ImportExport/Az.ImportExport.psm1 new file mode 100644 index 000000000000..5e068bb48774 --- /dev/null +++ b/src/ImportExport/Az.ImportExport.psm1 @@ -0,0 +1,109 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # + # Copyright Microsoft Corporation + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # http://www.apache.org/licenses/LICENSE-2.0 + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImportExport.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.ImportExport.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/ImportExport/MSSharedLibKey.snk b/src/ImportExport/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +#> +function Get-AzImportExportBitLockerKey { + [OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey])] + [CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, ConfirmImpact='Medium')] + param( + [Parameter(Mandatory, HelpMessage="The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${JobName}, + + [Parameter(Mandatory, HelpMessage="The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(HelpMessage="The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(HelpMessage="Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} + ) + + process { + Az.ImportExport.internal\Get-AzImportExportBitLockerKey @PSBoundParameters + } +} + \ No newline at end of file diff --git a/src/ImportExport/custom/New-AzImportExportDriveListObject.ps1 b/src/ImportExport/custom/New-AzImportExportDriveListObject.ps1 new file mode 100644 index 000000000000..b51ab1a1c870 --- /dev/null +++ b/src/ImportExport/custom/New-AzImportExportDriveListObject.ps1 @@ -0,0 +1,97 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a DriverList Object for ImportExport. +.Description +Create a DriverList Object for ImportExport. + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-AzImportExportDriveListObject +#> +function New-AzImportExportDriveListObject { + [OutputType('Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus')] + [CmdletBinding(PositionalBinding=$false)] + Param( + [Parameter(HelpMessage="The BitLocker key used to encrypt the drive.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${BitLockerKey}, + [Parameter(HelpMessage="Bytes successfully transferred for the drive.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Int64] + ${BytesSucceeded}, + [Parameter(HelpMessage="Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${CopyStatus}, + [Parameter(HelpMessage="The drive header hash value.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${DriveHeaderHash}, + [Parameter(HelpMessage="The drive's hardware serial number, without spaces.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${DriveId}, + [Parameter(HelpMessage="A URI that points to the blob containing the error log for the data transfer operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${ErrorLogUri}, + [Parameter(HelpMessage="The relative path of the manifest file on the drive.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${ManifestFile}, + [Parameter(HelpMessage="The Base16-encoded MD5 hash of the manifest file on the drive.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${ManifestHash}, + [Parameter(HelpMessage="A URI that points to the blob containing the drive manifest file.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${ManifestUri}, + [Parameter(HelpMessage="Percentage completed for the drive.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [int] + ${PercentComplete}, + [Parameter(HelpMessage="The drive's current state.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState] + ${State}, + [Parameter(HelpMessage="A URI that points to the blob containing the verbose log for the data transfer operation.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [string] + ${VerboseLogUri} + ) + + process { + $DriveStatus = [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus]::New() + $DriveStatus.BitLockerKey = $BitLockerKey + $DriveStatus.BytesSucceeded = $BytesSucceeded + $DriveStatus.CopyStatus = $CopyStatus + $DriveStatus.DriveHeaderHash = $DriveHeaderHash + $DriveStatus.DriveId = $DriveId + $DriveStatus.ErrorLogUri = $ErrorLogUri + $DriveStatus.ManifestFile = $ManifestFile + $DriveStatus.ManifestHash = $ManifestHash + $DriveStatus.ManifestUri = $ManifestUri + $DriveStatus.PercentComplete = $PercentComplete + $DriveStatus.State = $State + $DriveStatus.VerboseLogUri = $VerboseLogUri + + return $DriveStatus + } +} \ No newline at end of file diff --git a/src/ImportExport/custom/readme.md b/src/ImportExport/custom/readme.md new file mode 100644 index 000000000000..7651f83679c7 --- /dev/null +++ b/src/ImportExport/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.ImportExport` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.ImportExport.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.ImportExport` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.ImportExport.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.ImportExport.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.ImportExport`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.ImportExport`. +- `Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.ImportExport`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/ImportExport/examples/Get-AzImportExport.md b/src/ImportExport/examples/Get-AzImportExport.md new file mode 100644 index 000000000000..c1ee20c99537 --- /dev/null +++ b/src/ImportExport/examples/Get-AzImportExport.md @@ -0,0 +1,40 @@ +### Example 1: Get ImportExport job with default context +```powershell +PS C:\> Get-AzImportExport +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet gets ImportExport job with default context. + +### Example 2: Get ImportExport job by resource group and job name +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet gets ImportExport job by resource group and job name. + +### Example 3: Lists all the ImportExport jobs in specified resource group +```powershell +PS C:\> Get-AzImportExport -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet lists all the ImportExport jobs in specified resource group. + +### Example 4: Get ImportExport job by identity +```powershell +PS C:\> $Id = "/subscriptions//resourceGroups/ImportTestRG/providers/Microsoft.ImportExport/jobs/test-job" +PS C:\> Get-AzImportExport -InputObject $Id +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet lists gets ImportExport job by identity. \ No newline at end of file diff --git a/src/ImportExport/examples/Get-AzImportExportBitLockerKey.md b/src/ImportExport/examples/Get-AzImportExportBitLockerKey.md new file mode 100644 index 000000000000..88140f160285 --- /dev/null +++ b/src/ImportExport/examples/Get-AzImportExportBitLockerKey.md @@ -0,0 +1,9 @@ +### Example 1: List all BitLocker Keys in specified ImportExport job +```powershell +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA +``` + +This cmdlet lists all BitLocker Keys in specified ImportExport job. \ No newline at end of file diff --git a/src/ImportExport/examples/Get-AzImportExportLocation.md b/src/ImportExport/examples/Get-AzImportExportLocation.md new file mode 100644 index 000000000000..99cf71b659d7 --- /dev/null +++ b/src/ImportExport/examples/Get-AzImportExportLocation.md @@ -0,0 +1,40 @@ +### Example 1: Get all Azure region location details with default context +```powershell +PS C:\> Get-AzImportExportLocation +Name Type +---- ---- +Australia East Microsoft.ImportExport/locations +Australia Southeast Microsoft.ImportExport/locations +Brazil South Microsoft.ImportExport/locations +Canada Central Microsoft.ImportExport/locations +Canada East Microsoft.ImportExport/locations +... +West Central US Microsoft.ImportExport/locations +West Europe Microsoft.ImportExport/locations +West India Microsoft.ImportExport/locations +West US Microsoft.ImportExport/locations +West US 2 Microsoft.ImportExport/locations +``` + +This cmdlet gets all Azure region location details with default context. + +### Example 2: Get Azure region location details by location name +```powershell +PS C:\> Get-AzImportExportLocation -Name eastus +Name Type +---- ---- +East US Microsoft.ImportExport/locations +``` + +This cmdlet gets Azure region location details by location name. + +### Example 3: Get Azure region location details by identity +```powershell +PS C:\> $Id = "/providers/Microsoft.ImportExport/locations/eastus" +PS C:\> Get-AzImportExportLocation -InputObject $Id +Name Type +---- ---- +East US Microsoft.ImportExport/locations +``` + +This cmdlet lists gets Azure region location details by identity. \ No newline at end of file diff --git a/src/ImportExport/examples/New-AzImportExport.md b/src/ImportExport/examples/New-AzImportExport.md new file mode 100644 index 000000000000..dda6760d2952 --- /dev/null +++ b/src/ImportExport/examples/New-AzImportExport.md @@ -0,0 +1,10 @@ +### Example 1: Create a new ImportExport job +```powershell +PS C:\> $driveList = @( @{ DriveId = "9CA995BA"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) +PS C:\> New-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -Location eastus -StorageAccountId "/subscriptions//resourcegroups/ImportTestRG/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList +Location Name Type +-------- ---- ---- +eastus test-job Microsoft.ImportExport/jobs +``` + +These cmdlets create a new ImportExport job. \ No newline at end of file diff --git a/src/ImportExport/examples/New-AzImportExportDriveListObject.md b/src/ImportExport/examples/New-AzImportExportDriveListObject.md new file mode 100644 index 000000000000..1edeadc31bcd --- /dev/null +++ b/src/ImportExport/examples/New-AzImportExportDriveListObject.md @@ -0,0 +1,10 @@ +### Example 1: Create a new DriveList for ImportExport job +```powershell +PS C:\> New-AzImportExportDriveListObject -DriveId "9CA995BA" -BitLockerKey "238810-662376-448998-450120-652806-203390-606320-483076" -ManifestFile "\\DriveManifest.xml" -ManifestHash "109B21108597EF36D5785F08303F3638" + +BitLockerKey BytesSucceeded CopyStatus DriveHeaderHash DriveId ErrorLogUri ManifestFile ManifestHash ManifestUri PercentComplete State VerboseLogUri +------------ -------------- ---------- --------------- ------- ----------- ------------ ------------ ----------- --------------- ----- ------- +238810-662376-448998-450120-652806-203390-606320-483076 0 9CA995BA \\DriveManifest.xml 109B21108597EF36D5785F08303F3638 0 +``` + +These cmdlets create a new DriveList for ImportExport job. \ No newline at end of file diff --git a/src/ImportExport/examples/Remove-AzImportExport.md b/src/ImportExport/examples/Remove-AzImportExport.md new file mode 100644 index 000000000000..ae1e1fb7e518 --- /dev/null +++ b/src/ImportExport/examples/Remove-AzImportExport.md @@ -0,0 +1,14 @@ +### Example 1: Remove ImportExport job by resourceGroup and server name +```powershell +PS C:\> Remove-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +``` + +This cmdlet removes ImportExport job by resourceGroup and server name. + +### Example 2: Remove ImportExport job by identity +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Remove-AzImportExport + +``` + +These cmdlet removes ImportExport job by identity. \ No newline at end of file diff --git a/src/ImportExport/examples/Update-AzImportExport.md b/src/ImportExport/examples/Update-AzImportExport.md new file mode 100644 index 000000000000..5502e72c488b --- /dev/null +++ b/src/ImportExport/examples/Update-AzImportExport.md @@ -0,0 +1,19 @@ +### Example 1: Update ImportExport job by resource group and server name +```powershell +PS C:\> Update-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -DeliveryPackageCarrierName pwsh -DeliveryPackageTrackingNumber pwsh20200000 +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet updates ImportExport job by resource group and server name. + +### Example 2: Update ImportExport job by identity. +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Update-AzImportExport -CancelRequested +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet updates ImportExport job by identity. \ No newline at end of file diff --git a/src/ImportExport/export-surface.ps1 b/src/ImportExport/export-surface.ps1 new file mode 100644 index 000000000000..caed723089aa --- /dev/null +++ b/src/ImportExport/export-surface.ps1 @@ -0,0 +1,40 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.ImportExport.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.ImportExport' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImportExport/exports/Get-AzImportExport.ps1 b/src/ImportExport/exports/Get-AzImportExport.ps1 new file mode 100644 index 000000000000..86f822ba6121 --- /dev/null +++ b/src/ImportExport/exports/Get-AzImportExport.ps1 @@ -0,0 +1,204 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets information about an existing job. +.Description +Gets information about an existing job. +.Example +PS C:\> Get-AzImportExport +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> $Id = "/subscriptions//resourceGroups/ImportTestRG/providers/Microsoft.ImportExport/jobs/test-job" +PS C:\> Get-AzImportExport -InputObject $Id +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexport +#> +function Get-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Query')] + [System.String] + # Can be used to restrict the results to certain conditions. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Query')] + [System.Int32] + # An integer value that specifies how many jobs at most should be returned. + # The value cannot exceed 100. + ${Top}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImportExport.private\Get-AzImportExport_Get'; + GetViaIdentity = 'Az.ImportExport.private\Get-AzImportExport_GetViaIdentity'; + List = 'Az.ImportExport.private\Get-AzImportExport_List'; + List1 = 'Az.ImportExport.private\Get-AzImportExport_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/Get-AzImportExportBitLockerKey.ps1 b/src/ImportExport/exports/Get-AzImportExportBitLockerKey.ps1 new file mode 100644 index 000000000000..af1664b371cd --- /dev/null +++ b/src/ImportExport/exports/Get-AzImportExportBitLockerKey.ps1 @@ -0,0 +1,146 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the BitLocker Keys for all drives in the specified job. +.Description +Returns the BitLocker Keys for all drives in the specified job. +.Example +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +#> +function Get-AzImportExportBitLockerKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${JobName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.custom\Get-AzImportExportBitLockerKey'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/Get-AzImportExportLocation.ps1 b/src/ImportExport/exports/Get-AzImportExportLocation.ps1 new file mode 100644 index 000000000000..1d2f3044c26a --- /dev/null +++ b/src/ImportExport/exports/Get-AzImportExportLocation.ps1 @@ -0,0 +1,177 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. +.Description +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. +.Example +PS C:\> Get-AzImportExportLocation +Name Type +---- ---- +Australia East Microsoft.ImportExport/locations +Australia Southeast Microsoft.ImportExport/locations +Brazil South Microsoft.ImportExport/locations +Canada Central Microsoft.ImportExport/locations +Canada East Microsoft.ImportExport/locations +... +West Central US Microsoft.ImportExport/locations +West Europe Microsoft.ImportExport/locations +West India Microsoft.ImportExport/locations +West US Microsoft.ImportExport/locations +West US 2 Microsoft.ImportExport/locations +.Example +PS C:\> Get-AzImportExportLocation -Name eastus +Name Type +---- ---- +East US Microsoft.ImportExport/locations +.Example +PS C:\> $Id = "/providers/Microsoft.ImportExport/locations/eastus" +PS C:\> Get-AzImportExportLocation -InputObject $Id +Name Type +---- ---- +East US Microsoft.ImportExport/locations + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportlocation +#> +function Get-AzImportExportLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('LocationName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the location. + # For example, West US or westus. + ${Name}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImportExport.private\Get-AzImportExportLocation_Get'; + GetViaIdentity = 'Az.ImportExport.private\Get-AzImportExportLocation_GetViaIdentity'; + List = 'Az.ImportExport.private\Get-AzImportExportLocation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/New-AzImportExport.ps1 b/src/ImportExport/exports/New-AzImportExport.ps1 new file mode 100644 index 000000000000..fbc177f2459d --- /dev/null +++ b/src/ImportExport/exports/New-AzImportExport.ps1 @@ -0,0 +1,436 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates a new job or updates an existing job in the specified subscription. +.Description +Creates a new job or updates an existing job in the specified subscription. +.Example +PS C:\> $driveList = @( @{ DriveId = "9CA995BA"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) +PS C:\> New-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -Location eastus -StorageAccountId "/subscriptions//resourcegroups/ImportTestRG/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList +Location Name Type +-------- ---- ---- +eastus test-job Microsoft.ImportExport/jobs + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DRIVELIST : List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. + [BitLockerKey ]: The BitLocker key used to encrypt the drive. + [BytesSucceeded ]: Bytes successfully transferred for the drive. + [CopyStatus ]: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + [DriveHeaderHash ]: The drive header hash value. + [DriveId ]: The drive's hardware serial number, without spaces. + [ErrorLogUri ]: A URI that points to the blob containing the error log for the data transfer operation. + [ManifestFile ]: The relative path of the manifest file on the drive. + [ManifestHash ]: The Base16-encoded MD5 hash of the manifest file on the drive. + [ManifestUri ]: A URI that points to the blob containing the drive manifest file. + [PercentComplete ]: Percentage completed for the drive. + [State ]: The drive's current state. + [VerboseLogUri ]: A URI that points to the blob containing the verbose log for the data transfer operation. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-azimportexport +#> +function New-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # The tenant ID of the client making the request. + ${ClientTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Default value is false. + # Indicates whether the manifest files on the drives should be copied to block blobs. + ${BackupDriveManifest}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String[]] + # A collection of blob-path strings. + ${BlobListBlobPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String[]] + # A collection of blob-prefix strings. + ${BlobListBlobPathPrefix}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether a request has been submitted to cancel the job. + ${CancelRequested}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${DeliveryPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${DeliveryPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${DeliveryPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${DeliveryPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + ${DiagnosticsPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]] + # List of up to ten drives that comprise the job. + # The drive list is a required element for an import job; it is not specified for export jobs. + # To construct, see NOTES section for DRIVELIST properties and create a hash table. + ${DriveList}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. + # If the blob is in root container, the URI must begin with $root. + ${ExportBlobListblobPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. + # If all blobs were exported successfully, then this element is not included in the response. + ${IncompleteBlobListUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The type of job + ${JobType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Specifies the supported Azure location where the job should be created + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Default value is Error. + # Indicates whether error logging or verbose logging will be enabled. + ${LogLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # Overall percentage completed for the job. + ${PercentComplete}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Specifies the provisioning state of the job. + ${ProvisioningState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ReturnAddressCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ReturnAddressCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Email address of the recipient of the returned drives. + ${ReturnAddressEmail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ReturnAddressPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ReturnAddressPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ReturnAddressRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ReturnAddressStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${ReturnPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${ReturnPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${ReturnPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${ReturnPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The customer's account number with the carrier. + ${ReturnShippingCarrierAccountNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The carrier's name. + ${ReturnShippingCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ShippingInformationCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ShippingInformationCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ShippingInformationPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ShippingInformationPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ShippingInformationRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ShippingInformationStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ShippingInformationStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ShippingInformationStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Current state of the job. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The resource identifier of the storage account where data will be imported to or exported from. + ${StorageAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags] + # Specifies the tags that will be assigned to the job. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.ImportExport.private\New-AzImportExport_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/New-AzImportExportDriveListObject.ps1 b/src/ImportExport/exports/New-AzImportExportDriveListObject.ps1 new file mode 100644 index 000000000000..06822ff1c85b --- /dev/null +++ b/src/ImportExport/exports/New-AzImportExportDriveListObject.ps1 @@ -0,0 +1,145 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a DriverList Object for ImportExport. +.Description +Create a DriverList Object for ImportExport. +.Example +PS C:\> New-AzImportExportDriveListObject -DriveId "9CA995BA" -BitLockerKey "238810-662376-448998-450120-652806-203390-606320-483076" -ManifestFile "\\DriveManifest.xml" -ManifestHash "109B21108597EF36D5785F08303F3638" + +BitLockerKey BytesSucceeded CopyStatus DriveHeaderHash DriveId ErrorLogUri ManifestFile ManifestHash ManifestUri PercentComplete State VerboseLogUri +------------ -------------- ---------- --------------- ------- ----------- ------------ ------------ ----------- --------------- ----- ------- +238810-662376-448998-450120-652806-203390-606320-483076 0 9CA995BA \\DriveManifest.xml 109B21108597EF36D5785F08303F3638 0 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-AzImportExportDriveListObject +#> +function New-AzImportExportDriveListObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The BitLocker key used to encrypt the drive. + ${BitLockerKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int64] + # Bytes successfully transferred for the drive. + ${BytesSucceeded}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Detailed status about the data transfer process. + # This field is not returned in the response until the drive is in the Transferring state. + ${CopyStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The drive header hash value. + ${DriveHeaderHash}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The drive's hardware serial number, without spaces. + ${DriveId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the error log for the data transfer operation. + ${ErrorLogUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The relative path of the manifest file on the drive. + ${ManifestFile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The Base16-encoded MD5 hash of the manifest file on the drive. + ${ManifestHash}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the drive manifest file. + ${ManifestUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # Percentage completed for the drive. + ${PercentComplete}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState] + # The drive's current state. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the verbose log for the data transfer operation. + ${VerboseLogUri} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + __AllParameterSets = 'Az.ImportExport.custom\New-AzImportExportDriveListObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/ProxyCmdletDefinitions.ps1 b/src/ImportExport/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..fc5dbcdd12cd --- /dev/null +++ b/src/ImportExport/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,1604 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. +.Description +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. +.Example +PS C:\> Get-AzImportExportLocation +Name Type +---- ---- +Australia East Microsoft.ImportExport/locations +Australia Southeast Microsoft.ImportExport/locations +Brazil South Microsoft.ImportExport/locations +Canada Central Microsoft.ImportExport/locations +Canada East Microsoft.ImportExport/locations +... +West Central US Microsoft.ImportExport/locations +West Europe Microsoft.ImportExport/locations +West India Microsoft.ImportExport/locations +West US Microsoft.ImportExport/locations +West US 2 Microsoft.ImportExport/locations +.Example +PS C:\> Get-AzImportExportLocation -Name eastus +Name Type +---- ---- +East US Microsoft.ImportExport/locations +.Example +PS C:\> $Id = "/providers/Microsoft.ImportExport/locations/eastus" +PS C:\> Get-AzImportExportLocation -InputObject $Id +Name Type +---- ---- +East US Microsoft.ImportExport/locations + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportlocation +#> +function Get-AzImportExportLocation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('LocationName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the location. + # For example, West US or westus. + ${Name}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImportExport.private\Get-AzImportExportLocation_Get'; + GetViaIdentity = 'Az.ImportExport.private\Get-AzImportExportLocation_GetViaIdentity'; + List = 'Az.ImportExport.private\Get-AzImportExportLocation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Gets information about an existing job. +.Description +Gets information about an existing job. +.Example +PS C:\> Get-AzImportExport +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> $Id = "/subscriptions//resourceGroups/ImportTestRG/providers/Microsoft.ImportExport/jobs/test-job" +PS C:\> Get-AzImportExport -InputObject $Id +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexport +#> +function Get-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List1', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Query')] + [System.String] + # Can be used to restrict the results to certain conditions. + ${Filter}, + + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Query')] + [System.Int32] + # An integer value that specifies how many jobs at most should be returned. + # The value cannot exceed 100. + ${Top}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.ImportExport.private\Get-AzImportExport_Get'; + GetViaIdentity = 'Az.ImportExport.private\Get-AzImportExport_GetViaIdentity'; + List = 'Az.ImportExport.private\Get-AzImportExport_List'; + List1 = 'Az.ImportExport.private\Get-AzImportExport_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Creates a new job or updates an existing job in the specified subscription. +.Description +Creates a new job or updates an existing job in the specified subscription. +.Example +PS C:\> $driveList = @( @{ DriveId = "9CA995BA"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) +PS C:\> New-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -Location eastus -StorageAccountId "/subscriptions//resourcegroups/ImportTestRG/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList +Location Name Type +-------- ---- ---- +eastus test-job Microsoft.ImportExport/jobs + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DRIVELIST : List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. + [BitLockerKey ]: The BitLocker key used to encrypt the drive. + [BytesSucceeded ]: Bytes successfully transferred for the drive. + [CopyStatus ]: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + [DriveHeaderHash ]: The drive header hash value. + [DriveId ]: The drive's hardware serial number, without spaces. + [ErrorLogUri ]: A URI that points to the blob containing the error log for the data transfer operation. + [ManifestFile ]: The relative path of the manifest file on the drive. + [ManifestHash ]: The Base16-encoded MD5 hash of the manifest file on the drive. + [ManifestUri ]: A URI that points to the blob containing the drive manifest file. + [PercentComplete ]: Percentage completed for the drive. + [State ]: The drive's current state. + [VerboseLogUri ]: A URI that points to the blob containing the verbose log for the data transfer operation. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-azimportexport +#> +function New-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # The tenant ID of the client making the request. + ${ClientTenantId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Default value is false. + # Indicates whether the manifest files on the drives should be copied to block blobs. + ${BackupDriveManifest}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String[]] + # A collection of blob-path strings. + ${BlobListBlobPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String[]] + # A collection of blob-prefix strings. + ${BlobListBlobPathPrefix}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether a request has been submitted to cancel the job. + ${CancelRequested}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${DeliveryPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${DeliveryPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${DeliveryPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${DeliveryPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + ${DiagnosticsPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]] + # List of up to ten drives that comprise the job. + # The drive list is a required element for an import job; it is not specified for export jobs. + # To construct, see NOTES section for DRIVELIST properties and create a hash table. + ${DriveList}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. + # If the blob is in root container, the URI must begin with $root. + ${ExportBlobListblobPath}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. + # If all blobs were exported successfully, then this element is not included in the response. + ${IncompleteBlobListUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The type of job + ${JobType}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Specifies the supported Azure location where the job should be created + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Default value is Error. + # Indicates whether error logging or verbose logging will be enabled. + ${LogLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # Overall percentage completed for the job. + ${PercentComplete}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Specifies the provisioning state of the job. + ${ProvisioningState}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ReturnAddressCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ReturnAddressCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Email address of the recipient of the returned drives. + ${ReturnAddressEmail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ReturnAddressPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ReturnAddressPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ReturnAddressRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ReturnAddressStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${ReturnPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${ReturnPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${ReturnPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${ReturnPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The customer's account number with the carrier. + ${ReturnShippingCarrierAccountNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The carrier's name. + ${ReturnShippingCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ShippingInformationCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ShippingInformationCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ShippingInformationPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ShippingInformationPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ShippingInformationRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ShippingInformationStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ShippingInformationStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ShippingInformationStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Current state of the job. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The resource identifier of the storage account where data will be imported to or exported from. + ${StorageAccountId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags] + # Specifies the tags that will be assigned to the job. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.ImportExport.private\New-AzImportExport_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. +.Description +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. +.Example +PS C:\> Remove-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Remove-AzImportExport + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/remove-azimportexport +#> +function Remove-AzImportExport { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.ImportExport.private\Remove-AzImportExport_Delete'; + DeleteViaIdentity = 'Az.ImportExport.private\Remove-AzImportExport_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. +.Description +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. +.Example +PS C:\> Update-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -DeliveryPackageCarrierName pwsh -DeliveryPackageTrackingNumber pwsh20200000 +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Update-AzImportExport -CancelRequested +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DRIVELIST : List of drives that comprise the job. + [BitLockerKey ]: The BitLocker key used to encrypt the drive. + [BytesSucceeded ]: Bytes successfully transferred for the drive. + [CopyStatus ]: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + [DriveHeaderHash ]: The drive header hash value. + [DriveId ]: The drive's hardware serial number, without spaces. + [ErrorLogUri ]: A URI that points to the blob containing the error log for the data transfer operation. + [ManifestFile ]: The relative path of the manifest file on the drive. + [ManifestHash ]: The Base16-encoded MD5 hash of the manifest file on the drive. + [ManifestUri ]: A URI that points to the blob containing the drive manifest file. + [PercentComplete ]: Percentage completed for the drive. + [State ]: The drive's current state. + [VerboseLogUri ]: A URI that points to the blob containing the verbose log for the data transfer operation. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/update-azimportexport +#> +function Update-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the manifest files on the drives should be copied to block blobs. + ${BackupDriveManifest}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # If specified, the value must be true. + # The service will attempt to cancel the job. + ${CancelRequested}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${DeliveryPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${DeliveryPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${DeliveryPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${DeliveryPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]] + # List of drives that comprise the job. + # To construct, see NOTES section for DRIVELIST properties and create a hash table. + ${DriveList}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Indicates whether error logging or verbose logging is enabled. + ${LogLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ReturnAddressCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ReturnAddressCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Email address of the recipient of the returned drives. + ${ReturnAddressEmail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ReturnAddressPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ReturnAddressPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ReturnAddressRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ReturnAddressStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The customer's account number with the carrier. + ${ReturnShippingCarrierAccountNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The carrier's name. + ${ReturnShippingCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. + # The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags] + # Specifies the tags that will be assigned to the job + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.ImportExport.private\Update-AzImportExport_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.ImportExport.private\Update-AzImportExport_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the BitLocker Keys for all drives in the specified job. +.Description +Returns the BitLocker Keys for all drives in the specified job. +.Example +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +#> +function Get-AzImportExportBitLockerKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${JobName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.custom\Get-AzImportExportBitLockerKey'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a DriverList Object for ImportExport. +.Description +Create a DriverList Object for ImportExport. +.Example +PS C:\> New-AzImportExportDriveListObject -DriveId "9CA995BA" -BitLockerKey "238810-662376-448998-450120-652806-203390-606320-483076" -ManifestFile "\\DriveManifest.xml" -ManifestHash "109B21108597EF36D5785F08303F3638" + +BitLockerKey BytesSucceeded CopyStatus DriveHeaderHash DriveId ErrorLogUri ManifestFile ManifestHash ManifestUri PercentComplete State VerboseLogUri +------------ -------------- ---------- --------------- ------- ----------- ------------ ------------ ----------- --------------- ----- ------- +238810-662376-448998-450120-652806-203390-606320-483076 0 9CA995BA \\DriveManifest.xml 109B21108597EF36D5785F08303F3638 0 + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-AzImportExportDriveListObject +#> +function New-AzImportExportDriveListObject { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus])] +[CmdletBinding(PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The BitLocker key used to encrypt the drive. + ${BitLockerKey}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int64] + # Bytes successfully transferred for the drive. + ${BytesSucceeded}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Detailed status about the data transfer process. + # This field is not returned in the response until the drive is in the Transferring state. + ${CopyStatus}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The drive header hash value. + ${DriveHeaderHash}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The drive's hardware serial number, without spaces. + ${DriveId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the error log for the data transfer operation. + ${ErrorLogUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The relative path of the manifest file on the drive. + ${ManifestFile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The Base16-encoded MD5 hash of the manifest file on the drive. + ${ManifestHash}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the drive manifest file. + ${ManifestUri}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # Percentage completed for the drive. + ${PercentComplete}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState] + # The drive's current state. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # A URI that points to the blob containing the verbose log for the data transfer operation. + ${VerboseLogUri} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + __AllParameterSets = 'Az.ImportExport.custom\New-AzImportExportDriveListObject'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/Remove-AzImportExport.ps1 b/src/ImportExport/exports/Remove-AzImportExport.ps1 new file mode 100644 index 000000000000..835954317798 --- /dev/null +++ b/src/ImportExport/exports/Remove-AzImportExport.ps1 @@ -0,0 +1,176 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. +.Description +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. +.Example +PS C:\> Remove-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Remove-AzImportExport + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/remove-azimportexport +#> +function Remove-AzImportExport { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.ImportExport.private\Remove-AzImportExport_Delete'; + DeleteViaIdentity = 'Az.ImportExport.private\Remove-AzImportExport_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/Update-AzImportExport.ps1 b/src/ImportExport/exports/Update-AzImportExport.ps1 new file mode 100644 index 000000000000..80f653df8c61 --- /dev/null +++ b/src/ImportExport/exports/Update-AzImportExport.ps1 @@ -0,0 +1,320 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. +.Description +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. +.Example +PS C:\> Update-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -DeliveryPackageCarrierName pwsh -DeliveryPackageTrackingNumber pwsh20200000 +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +.Example +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Update-AzImportExport -CancelRequested +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +DRIVELIST : List of drives that comprise the job. + [BitLockerKey ]: The BitLocker key used to encrypt the drive. + [BytesSucceeded ]: Bytes successfully transferred for the drive. + [CopyStatus ]: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + [DriveHeaderHash ]: The drive header hash value. + [DriveId ]: The drive's hardware serial number, without spaces. + [ErrorLogUri ]: A URI that points to the blob containing the error log for the data transfer operation. + [ManifestFile ]: The relative path of the manifest file on the drive. + [ManifestHash ]: The Base16-encoded MD5 hash of the manifest file on the drive. + [ManifestUri ]: A URI that points to the blob containing the drive manifest file. + [PercentComplete ]: Percentage completed for the drive. + [State ]: The drive's current state. + [VerboseLogUri ]: A URI that points to the blob containing the verbose log for the data transfer operation. + +INPUTOBJECT : Identity Parameter + [Id ]: Resource identity path + [JobName ]: The name of the import/export job. + [LocationName ]: The name of the location. For example, West US or westus. + [ResourceGroupName ]: The resource group name uniquely identifies the resource group within the user subscription. + [SubscriptionId ]: The subscription ID for the Azure user. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/update-azimportexport +#> +function Update-AzImportExport { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('JobName')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # Indicates whether the manifest files on the drives should be copied to block blobs. + ${BackupDriveManifest}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Management.Automation.SwitchParameter] + # If specified, the value must be true. + # The service will attempt to cancel the job. + ${CancelRequested}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the carrier that is used to ship the import or export drives. + ${DeliveryPackageCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.Int32] + # The number of drives included in the package. + ${DeliveryPackageDriveCount}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The date when the package is shipped. + ${DeliveryPackageShipDate}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The tracking number of the package. + ${DeliveryPackageTrackingNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]] + # List of drives that comprise the job. + # To construct, see NOTES section for DRIVELIST properties and create a hash table. + ${DriveList}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Indicates whether error logging or verbose logging is enabled. + ${LogLevel}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The city name to use when returning the drives. + ${ReturnAddressCity}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The country or region to use when returning the drives. + ${ReturnAddressCountryOrRegion}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Email address of the recipient of the returned drives. + ${ReturnAddressEmail}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # Phone number of the recipient of the returned drives. + ${ReturnAddressPhone}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The postal code to use when returning the drives. + ${ReturnAddressPostalCode}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The name of the recipient who will receive the hard drives when they are returned. + ${ReturnAddressRecipientName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The state or province to use when returning the drives. + ${ReturnAddressStateOrProvince}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The first line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress1}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The second line of the street address to use when returning the drives. + ${ReturnAddressStreetAddress2}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The customer's account number with the carrier. + ${ReturnShippingCarrierAccountNumber}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # The carrier's name. + ${ReturnShippingCarrierName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [System.String] + # If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. + # The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. + ${State}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags] + # Specifies the tags that will be assigned to the job + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.ImportExport.private\Update-AzImportExport_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.ImportExport.private\Update-AzImportExport_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/exports/readme.md b/src/ImportExport/exports/readme.md new file mode 100644 index 000000000000..eadb79da07ac --- /dev/null +++ b/src/ImportExport/exports/readme.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.ImportExport`. No other cmdlets in this repository are directly exported. What that means is the `Az.ImportExport` module will run [Export-ModuleMember](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.ImportExport.private.dll`) and from the `..\custom\Az.ImportExport.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [readme.md](..\internal/readme.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.ImportExport.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/ImportExport/generate-help.ps1 b/src/ImportExport/generate-help.ps1 new file mode 100644 index 000000000000..c420d37d6f53 --- /dev/null +++ b/src/ImportExport/generate-help.ps1 @@ -0,0 +1,73 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImportExport.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.ImportExport.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImportExport/generate-info.json b/src/ImportExport/generate-info.json new file mode 100644 index 000000000000..ba69c302620d --- /dev/null +++ b/src/ImportExport/generate-info.json @@ -0,0 +1,8 @@ +{ + "autorest_remodeler": "2.1.27", + "autorest_powershell": "2.1.384", + "autorest_core": "3.0.6282", + "node": "v10.16.3", + "autorest": "3.0.6149", + "swagger_commit": "76b6bd1989a8248987219b840f525b02e07807dc" +} diff --git a/src/ImportExport/generated/Module.cs b/src/ImportExport/generated/Module.cs new file mode 100644 index 000000000000..6463b4145dc0 --- /dev/null +++ b/src/ImportExport/generated/Module.cs @@ -0,0 +1,158 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline _pipelineWithProxy; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module()); + + /// The Name of this module + public string Name => @"Az.ImportExport"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.ImportExport"; + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + /// constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; + _handler.UseProxy = proxy != null; + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/ImportExport.cs b/src/ImportExport/generated/api/ImportExport.cs new file mode 100644 index 000000000000..7d43f1d7e9e5 --- /dev/null +++ b/src/ImportExport/generated/api/ImportExport.cs @@ -0,0 +1,1833 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Low-level API implementation for the ImportExport service. + /// + public partial class ImportExport + { + + /// Returns the BitLocker Keys for all drives in the specified job. + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BitLockerKeysList(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "/listBitLockerKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BitLockerKeysList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns the BitLocker Keys for all drives in the specified job. + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BitLockerKeysListViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs/(?[^/]+)/listBitLockerKeys$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys'"); + } + + // replace URI parameters with values from identity + var jobName = _match.Groups["jobName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs/" + + jobName + + "/listBitLockerKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BitLockerKeysList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BitLockerKeysList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.GetBitLockerKeysResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BitLockerKeysList_Validate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// Creates a new job or updates an existing job in the specified subscription. + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// The tenant ID of the client making the request. + /// The parameters used for creating the job + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsCreate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, string clientTenantId, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + if (null != clientTenantId) + { + request.Headers.Add("x-ms-client-tenant-id",clientTenantId); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCreate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Creates a new job or updates an existing job in the specified subscription. + /// + /// Specifies the preferred language for the response. + /// The tenant ID of the client making the request. + /// The parameters used for creating the job + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsCreateViaIdentity(global::System.String viaIdentity, string acceptLanguage, string clientTenantId, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var jobName = _match.Groups["jobName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + if (null != clientTenantId) + { + request.Headers.Add("x-ms-client-tenant-id",clientTenantId); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsCreate_Call(request,onOk,onCreated,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 201 (Created). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onCreated, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.Created: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onCreated(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// The tenant ID of the client making the request. + /// The parameters used for creating the job + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsCreate_Validate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, string clientTenantId, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters body, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(clientTenantId),clientTenantId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsDelete(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsDelete_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + /// + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsDeleteViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var jobName = _match.Groups["jobName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsDelete_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsDelete_Validate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// Gets information about an existing job. + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsGet(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Gets information about an existing job. + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsGetViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var jobName = _match.Groups["jobName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsGet_Validate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// Returns all active and completed jobs in a resource group. + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsListByResourceGroup(int? Top, string Filter, string subscriptionId, string resourceGroupName, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns all active and completed jobs in a resource group. + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsListByResourceGroupViaIdentity(global::System.String viaIdentity, int? Top, string Filter, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListByResourceGroup_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsListByResourceGroup_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ListJobsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsListByResourceGroup_Validate(int? Top, string Filter, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// Returns all active and completed jobs in a subscription. + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// The subscription ID for the Azure user. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsListBySubscription(int? Top, string Filter, string subscriptionId, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.ImportExport/jobs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Returns all active and completed jobs in a subscription. + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsListBySubscriptionViaIdentity(global::System.String viaIdentity, int? Top, string Filter, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.ImportExport/jobs$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.ImportExport/jobs" + + "?" + + (null == Top ? global::System.String.Empty : "$top=" + global::System.Uri.EscapeDataString(Top.ToString())) + + "&" + + (string.IsNullOrEmpty(Filter) ? global::System.String.Empty : "$filter=" + global::System.Uri.EscapeDataString(Filter)) + + "&" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsListBySubscription_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsListBySubscription_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ListJobsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// Can be used to restrict the results to certain conditions. + /// The subscription ID for the Azure user. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsListBySubscription_Validate(int? Top, string Filter, string subscriptionId, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(Filter),Filter); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// + /// Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives + /// comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing + /// job. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// The parameters to update in the job + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsUpdate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.ImportExport/jobs/" + + global::System.Uri.EscapeDataString(jobName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives + /// comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing + /// job. + /// + /// + /// Specifies the preferred language for the response. + /// The parameters to update in the job + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task JobsUpdateViaIdentity(global::System.String viaIdentity, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters body, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.ImportExport/jobs/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}'"); + } + + // replace URI parameters with values from identity + var jobName = _match.Groups["jobName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.ImportExport/jobs/" + + jobName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.JobsUpdate_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// The name of the import/export job. + /// The subscription ID for the Azure user. + /// The resource group name uniquely identifies the resource group within the user subscription. + /// Specifies the preferred language for the response. + /// The parameters to update in the job + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task JobsUpdate_Validate(string jobName, string subscriptionId, string resourceGroupName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters body, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(jobName),jobName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// + /// Returns the details about a location to which you can ship the disks associated with an import or export job. A location + /// is an Azure region. + /// + /// The name of the location. For example, West US or westus. + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsGet(string locationName, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/locations/" + + global::System.Uri.EscapeDataString(locationName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns the details about a location to which you can ship the disks associated with an import or export job. A location + /// is an Azure region. + /// + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsGetViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.ImportExport/locations/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.ImportExport/locations/{locationName}'"); + } + + // replace URI parameters with values from identity + var locationName = _match.Groups["locationName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/locations/" + + locationName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsGet_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Location.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// The name of the location. For example, West US or westus. + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsGet_Validate(string locationName, string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(locationName),locationName); + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// + /// Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft + /// data center region. + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsList(string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/locations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft + /// data center region. + /// + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsListViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.ImportExport/locations$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.ImportExport/locations'"); + } + + // replace URI parameters with values from identity + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/locations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsList_Validate(string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + + /// + /// Returns the list of operations supported by the import/export resource provider. + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// + /// Returns the list of operations supported by the import/export resource provider. + /// + /// + /// Specifies the preferred language for the response. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, string acceptLanguage, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + var apiVersion = @"2016-11-01"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.ImportExport/operations$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.ImportExport/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.ImportExport/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // add headers parameters + if (null != acceptLanguage) + { + request.Headers.Add("Accept-Language",acceptLanguage); + } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,onDefault,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns default (any response code not handled + /// elsewhere). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func, global::System.Threading.Tasks.Task> onDefault, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ListOperationsResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onDefault(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponse.FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Specifies the preferred language for the response. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(string acceptLanguage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(acceptLanguage),acceptLanguage); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.PowerShell.cs new file mode 100644 index 000000000000..47d5bf5f028a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// BitLocker recovery key or password to the specified drive + [System.ComponentModel.TypeConverter(typeof(DriveBitLockerKeyTypeConverter))] + public partial class DriveBitLockerKey + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DriveBitLockerKey(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DriveBitLockerKey(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DriveBitLockerKey(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).BitLockerKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).DriveId = (string) content.GetValueForProperty("DriveId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).DriveId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DriveBitLockerKey(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).BitLockerKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).DriveId = (string) content.GetValueForProperty("DriveId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal)this).DriveId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// BitLocker recovery key or password to the specified drive + [System.ComponentModel.TypeConverter(typeof(DriveBitLockerKeyTypeConverter))] + public partial interface IDriveBitLockerKey + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.TypeConverter.cs new file mode 100644 index 000000000000..f4ec9ecd709c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DriveBitLockerKeyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DriveBitLockerKey.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DriveBitLockerKey.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DriveBitLockerKey.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.cs new file mode 100644 index 000000000000..9a259f088a81 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// BitLocker recovery key or password to the specified drive + public partial class DriveBitLockerKey : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKeyInternal + { + + /// Backing field for property. + private string _bitLockerKey; + + /// BitLocker recovery key or password + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string BitLockerKey { get => this._bitLockerKey; set => this._bitLockerKey = value; } + + /// Backing field for property. + private string _driveId; + + /// Drive ID + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string DriveId { get => this._driveId; set => this._driveId = value; } + + /// Creates an new instance. + public DriveBitLockerKey() + { + + } + } + /// BitLocker recovery key or password to the specified drive + public partial interface IDriveBitLockerKey : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// BitLocker recovery key or password + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"BitLocker recovery key or password", + SerializedName = @"bitLockerKey", + PossibleTypes = new [] { typeof(string) })] + string BitLockerKey { get; set; } + /// Drive ID + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Drive ID", + SerializedName = @"driveId", + PossibleTypes = new [] { typeof(string) })] + string DriveId { get; set; } + + } + /// BitLocker recovery key or password to the specified drive + internal partial interface IDriveBitLockerKeyInternal + + { + /// BitLocker recovery key or password + string BitLockerKey { get; set; } + /// Drive ID + string DriveId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.json.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.json.cs new file mode 100644 index 000000000000..32ba529023f5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveBitLockerKey.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// BitLocker recovery key or password to the specified drive + public partial class DriveBitLockerKey + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal DriveBitLockerKey(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_bitLockerKey = If( json?.PropertyT("bitLockerKey"), out var __jsonBitLockerKey) ? (string)__jsonBitLockerKey : (string)BitLockerKey;} + {_driveId = If( json?.PropertyT("driveId"), out var __jsonDriveId) ? (string)__jsonDriveId : (string)DriveId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new DriveBitLockerKey(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._bitLockerKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._bitLockerKey.ToString()) : null, "bitLockerKey" ,container.Add ); + AddIf( null != (((object)this._driveId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._driveId.ToString()) : null, "driveId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.PowerShell.cs new file mode 100644 index 000000000000..9e3ba9ccf0fe --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.PowerShell.cs @@ -0,0 +1,153 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Provides information about the drive's status + [System.ComponentModel.TypeConverter(typeof(DriveStatusTypeConverter))] + public partial class DriveStatus + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new DriveStatus(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new DriveStatus(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal DriveStatus(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BitLockerKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BytesSucceeded = (long?) content.GetValueForProperty("BytesSucceeded",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BytesSucceeded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).CopyStatus, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveHeaderHash = (string) content.GetValueForProperty("DriveHeaderHash",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveHeaderHash, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveId = (string) content.GetValueForProperty("DriveId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ErrorLogUri = (string) content.GetValueForProperty("ErrorLogUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ErrorLogUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestFile, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestHash, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestUri = (string) content.GetValueForProperty("ManifestUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).VerboseLogUri = (string) content.GetValueForProperty("VerboseLogUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).VerboseLogUri, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal DriveStatus(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BitLockerKey = (string) content.GetValueForProperty("BitLockerKey",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BitLockerKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BytesSucceeded = (long?) content.GetValueForProperty("BytesSucceeded",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).BytesSucceeded, (__y)=> (long) global::System.Convert.ChangeType(__y, typeof(long))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).CopyStatus = (string) content.GetValueForProperty("CopyStatus",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).CopyStatus, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveHeaderHash = (string) content.GetValueForProperty("DriveHeaderHash",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveHeaderHash, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveId = (string) content.GetValueForProperty("DriveId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).DriveId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ErrorLogUri = (string) content.GetValueForProperty("ErrorLogUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ErrorLogUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestFile = (string) content.GetValueForProperty("ManifestFile",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestFile, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestHash = (string) content.GetValueForProperty("ManifestHash",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestHash, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestUri = (string) content.GetValueForProperty("ManifestUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).ManifestUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).State = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState?) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).State, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).VerboseLogUri = (string) content.GetValueForProperty("VerboseLogUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal)this).VerboseLogUri, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provides information about the drive's status + [System.ComponentModel.TypeConverter(typeof(DriveStatusTypeConverter))] + public partial interface IDriveStatus + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.TypeConverter.cs new file mode 100644 index 000000000000..d26c6b473722 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class DriveStatusTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return DriveStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return DriveStatus.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return DriveStatus.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.cs new file mode 100644 index 000000000000..85921bcabe9c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.cs @@ -0,0 +1,254 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Provides information about the drive's status + public partial class DriveStatus : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatusInternal + { + + /// Backing field for property. + private string _bitLockerKey; + + /// The BitLocker key used to encrypt the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string BitLockerKey { get => this._bitLockerKey; set => this._bitLockerKey = value; } + + /// Backing field for property. + private long? _bytesSucceeded; + + /// Bytes successfully transferred for the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public long? BytesSucceeded { get => this._bytesSucceeded; set => this._bytesSucceeded = value; } + + /// Backing field for property. + private string _copyStatus; + + /// + /// Detailed status about the data transfer process. This field is not returned in the response until the drive is in the + /// Transferring state. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CopyStatus { get => this._copyStatus; set => this._copyStatus = value; } + + /// Backing field for property. + private string _driveHeaderHash; + + /// The drive header hash value. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string DriveHeaderHash { get => this._driveHeaderHash; set => this._driveHeaderHash = value; } + + /// Backing field for property. + private string _driveId; + + /// The drive's hardware serial number, without spaces. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string DriveId { get => this._driveId; set => this._driveId = value; } + + /// Backing field for property. + private string _errorLogUri; + + /// + /// A URI that points to the blob containing the error log for the data transfer operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ErrorLogUri { get => this._errorLogUri; set => this._errorLogUri = value; } + + /// Backing field for property. + private string _manifestFile; + + /// The relative path of the manifest file on the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ManifestFile { get => this._manifestFile; set => this._manifestFile = value; } + + /// Backing field for property. + private string _manifestHash; + + /// The Base16-encoded MD5 hash of the manifest file on the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ManifestHash { get => this._manifestHash; set => this._manifestHash = value; } + + /// Backing field for property. + private string _manifestUri; + + /// A URI that points to the blob containing the drive manifest file. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ManifestUri { get => this._manifestUri; set => this._manifestUri = value; } + + /// Backing field for property. + private int? _percentComplete; + + /// Percentage completed for the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public int? PercentComplete { get => this._percentComplete; set => this._percentComplete = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState? _state; + + /// The drive's current state. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState? State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _verboseLogUri; + + /// + /// A URI that points to the blob containing the verbose log for the data transfer operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string VerboseLogUri { get => this._verboseLogUri; set => this._verboseLogUri = value; } + + /// Creates an new instance. + public DriveStatus() + { + + } + } + /// Provides information about the drive's status + public partial interface IDriveStatus : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// The BitLocker key used to encrypt the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The BitLocker key used to encrypt the drive.", + SerializedName = @"bitLockerKey", + PossibleTypes = new [] { typeof(string) })] + string BitLockerKey { get; set; } + /// Bytes successfully transferred for the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Bytes successfully transferred for the drive.", + SerializedName = @"bytesSucceeded", + PossibleTypes = new [] { typeof(long) })] + long? BytesSucceeded { get; set; } + /// + /// Detailed status about the data transfer process. This field is not returned in the response until the drive is in the + /// Transferring state. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state.", + SerializedName = @"copyStatus", + PossibleTypes = new [] { typeof(string) })] + string CopyStatus { get; set; } + /// The drive header hash value. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The drive header hash value.", + SerializedName = @"driveHeaderHash", + PossibleTypes = new [] { typeof(string) })] + string DriveHeaderHash { get; set; } + /// The drive's hardware serial number, without spaces. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The drive's hardware serial number, without spaces.", + SerializedName = @"driveId", + PossibleTypes = new [] { typeof(string) })] + string DriveId { get; set; } + /// + /// A URI that points to the blob containing the error log for the data transfer operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A URI that points to the blob containing the error log for the data transfer operation.", + SerializedName = @"errorLogUri", + PossibleTypes = new [] { typeof(string) })] + string ErrorLogUri { get; set; } + /// The relative path of the manifest file on the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative path of the manifest file on the drive. ", + SerializedName = @"manifestFile", + PossibleTypes = new [] { typeof(string) })] + string ManifestFile { get; set; } + /// The Base16-encoded MD5 hash of the manifest file on the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The Base16-encoded MD5 hash of the manifest file on the drive.", + SerializedName = @"manifestHash", + PossibleTypes = new [] { typeof(string) })] + string ManifestHash { get; set; } + /// A URI that points to the blob containing the drive manifest file. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A URI that points to the blob containing the drive manifest file. ", + SerializedName = @"manifestUri", + PossibleTypes = new [] { typeof(string) })] + string ManifestUri { get; set; } + /// Percentage completed for the drive. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Percentage completed for the drive. ", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + int? PercentComplete { get; set; } + /// The drive's current state. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The drive's current state. ", + SerializedName = @"state", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState? State { get; set; } + /// + /// A URI that points to the blob containing the verbose log for the data transfer operation. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A URI that points to the blob containing the verbose log for the data transfer operation. ", + SerializedName = @"verboseLogUri", + PossibleTypes = new [] { typeof(string) })] + string VerboseLogUri { get; set; } + + } + /// Provides information about the drive's status + internal partial interface IDriveStatusInternal + + { + /// The BitLocker key used to encrypt the drive. + string BitLockerKey { get; set; } + /// Bytes successfully transferred for the drive. + long? BytesSucceeded { get; set; } + /// + /// Detailed status about the data transfer process. This field is not returned in the response until the drive is in the + /// Transferring state. + /// + string CopyStatus { get; set; } + /// The drive header hash value. + string DriveHeaderHash { get; set; } + /// The drive's hardware serial number, without spaces. + string DriveId { get; set; } + /// + /// A URI that points to the blob containing the error log for the data transfer operation. + /// + string ErrorLogUri { get; set; } + /// The relative path of the manifest file on the drive. + string ManifestFile { get; set; } + /// The Base16-encoded MD5 hash of the manifest file on the drive. + string ManifestHash { get; set; } + /// A URI that points to the blob containing the drive manifest file. + string ManifestUri { get; set; } + /// Percentage completed for the drive. + int? PercentComplete { get; set; } + /// The drive's current state. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState? State { get; set; } + /// + /// A URI that points to the blob containing the verbose log for the data transfer operation. + /// + string VerboseLogUri { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.json.cs b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.json.cs new file mode 100644 index 000000000000..a98bdcdee222 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/DriveStatus.json.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Provides information about the drive's status + public partial class DriveStatus + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal DriveStatus(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_bitLockerKey = If( json?.PropertyT("bitLockerKey"), out var __jsonBitLockerKey) ? (string)__jsonBitLockerKey : (string)BitLockerKey;} + {_bytesSucceeded = If( json?.PropertyT("bytesSucceeded"), out var __jsonBytesSucceeded) ? (long?)__jsonBytesSucceeded : BytesSucceeded;} + {_copyStatus = If( json?.PropertyT("copyStatus"), out var __jsonCopyStatus) ? (string)__jsonCopyStatus : (string)CopyStatus;} + {_driveHeaderHash = If( json?.PropertyT("driveHeaderHash"), out var __jsonDriveHeaderHash) ? (string)__jsonDriveHeaderHash : (string)DriveHeaderHash;} + {_driveId = If( json?.PropertyT("driveId"), out var __jsonDriveId) ? (string)__jsonDriveId : (string)DriveId;} + {_errorLogUri = If( json?.PropertyT("errorLogUri"), out var __jsonErrorLogUri) ? (string)__jsonErrorLogUri : (string)ErrorLogUri;} + {_manifestFile = If( json?.PropertyT("manifestFile"), out var __jsonManifestFile) ? (string)__jsonManifestFile : (string)ManifestFile;} + {_manifestHash = If( json?.PropertyT("manifestHash"), out var __jsonManifestHash) ? (string)__jsonManifestHash : (string)ManifestHash;} + {_manifestUri = If( json?.PropertyT("manifestUri"), out var __jsonManifestUri) ? (string)__jsonManifestUri : (string)ManifestUri;} + {_percentComplete = If( json?.PropertyT("percentComplete"), out var __jsonPercentComplete) ? (int?)__jsonPercentComplete : PercentComplete;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_verboseLogUri = If( json?.PropertyT("verboseLogUri"), out var __jsonVerboseLogUri) ? (string)__jsonVerboseLogUri : (string)VerboseLogUri;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new DriveStatus(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._bitLockerKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._bitLockerKey.ToString()) : null, "bitLockerKey" ,container.Add ); + AddIf( null != this._bytesSucceeded ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNumber((long)this._bytesSucceeded) : null, "bytesSucceeded" ,container.Add ); + AddIf( null != (((object)this._copyStatus)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._copyStatus.ToString()) : null, "copyStatus" ,container.Add ); + AddIf( null != (((object)this._driveHeaderHash)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._driveHeaderHash.ToString()) : null, "driveHeaderHash" ,container.Add ); + AddIf( null != (((object)this._driveId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._driveId.ToString()) : null, "driveId" ,container.Add ); + AddIf( null != (((object)this._errorLogUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._errorLogUri.ToString()) : null, "errorLogUri" ,container.Add ); + AddIf( null != (((object)this._manifestFile)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._manifestFile.ToString()) : null, "manifestFile" ,container.Add ); + AddIf( null != (((object)this._manifestHash)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._manifestHash.ToString()) : null, "manifestHash" ,container.Add ); + AddIf( null != (((object)this._manifestUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._manifestUri.ToString()) : null, "manifestUri" ,container.Add ); + AddIf( null != this._percentComplete ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNumber((int)this._percentComplete) : null, "percentComplete" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._verboseLogUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._verboseLogUri.ToString()) : null, "verboseLogUri" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.PowerShell.cs new file mode 100644 index 000000000000..2419dd3237d5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Response when errors occurred + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial class ErrorResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponse(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Innererror = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) content.GetValueForProperty("Innererror",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Innererror, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItemTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Error = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError) content.GetValueForProperty("Error",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Error, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Innererror = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) content.GetValueForProperty("Innererror",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Innererror, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItemTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Response when errors occurred + [System.ComponentModel.TypeConverter(typeof(ErrorResponseTypeConverter))] + public partial interface IErrorResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.TypeConverter.cs new file mode 100644 index 000000000000..8df88b54762e --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.cs new file mode 100644 index 000000000000..19d3e3ea2783 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Response when errors occurred + public partial class ErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal + { + + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string Code { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Code; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Code = value; } + + /// Describes the error details if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Detail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Detail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError _error; + + /// Describes the error information. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseError()); set => this._error = value; } + + /// Inner error object if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Innererror; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Innererror = value; } + + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string Message { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Message; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Message = value; } + + /// Internal Acessors for Error + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseInternal.Error { get => (this._error = this._error ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseError()); set { {_error = value;} } } + + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string Target { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Target; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)Error).Target = value; } + + /// Creates an new instance. + public ErrorResponse() + { + + } + } + /// Response when errors occurred + public partial interface IErrorResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Describes the error details if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Describes the error details if present.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get; set; } + /// Inner error object if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Inner error object if present.", + SerializedName = @"innererror", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get; set; } + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Response when errors occurred + internal partial interface IErrorResponseInternal + + { + /// Provides information about the error code. + string Code { get; set; } + /// Describes the error details if present. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get; set; } + /// Describes the error information. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError Error { get; set; } + /// Inner error object if present. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get; set; } + /// Provides information about the error message. + string Message { get; set; } + /// Provides information about the error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.json.cs new file mode 100644 index 000000000000..3796a64cb1e9 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponse.json.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Response when errors occurred + public partial class ErrorResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_error = If( json?.PropertyT("error"), out var __jsonError) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseError.FromJson(__jsonError) : Error;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ErrorResponse(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._error ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._error.ToJson(null,serializationMode) : null, "error" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.PowerShell.cs new file mode 100644 index 000000000000..e477afd6e2be --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Describes the error information. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorTypeConverter))] + public partial class ErrorResponseError + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponseError(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponseError(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponseError(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Innererror = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) content.GetValueForProperty("Innererror",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Innererror, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItemTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponseError(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Innererror = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) content.GetValueForProperty("Innererror",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Innererror, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererrorTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Target, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Detail = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[]) content.GetValueForProperty("Detail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal)this).Detail, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItemTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes the error information. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorTypeConverter))] + public partial interface IErrorResponseError + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.TypeConverter.cs new file mode 100644 index 000000000000..9166a697654a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseErrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponseError.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponseError.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponseError.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.cs new file mode 100644 index 000000000000..f8a4a125fd5d --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Describes the error information. + public partial class ErrorResponseError : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInternal + { + + /// Backing field for property. + private string _code; + + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] _detail; + + /// Describes the error details if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get => this._detail; set => this._detail = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror _innererror; + + /// Inner error object if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get => (this._innererror = this._innererror ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererror()); set => this._innererror = value; } + + /// Backing field for property. + private string _message; + + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _target; + + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public ErrorResponseError() + { + + } + } + /// Describes the error information. + public partial interface IErrorResponseError : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Describes the error details if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Describes the error details if present.", + SerializedName = @"details", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get; set; } + /// Inner error object if present. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Inner error object if present.", + SerializedName = @"innererror", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get; set; } + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + /// Describes the error information. + internal partial interface IErrorResponseErrorInternal + + { + /// Provides information about the error code. + string Code { get; set; } + /// Describes the error details if present. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem[] Detail { get; set; } + /// Inner error object if present. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror Innererror { get; set; } + /// Provides information about the error message. + string Message { get; set; } + /// Provides information about the error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.json.cs new file mode 100644 index 000000000000..5d6f51d3660e --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseError.json.cs @@ -0,0 +1,117 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Describes the error information. + public partial class ErrorResponseError + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponseError(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_innererror = If( json?.PropertyT("innererror"), out var __jsonInnererror) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorInnererror.FromJson(__jsonInnererror) : Innererror;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + {_detail = If( json?.PropertyT("details"), out var __jsonDetails) ? If( __jsonDetails as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ErrorResponseErrorDetailsItem.FromJson(__u) )) ))() : null : Detail;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseError FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ErrorResponseError(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != this._innererror ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._innererror.ToJson(null,serializationMode) : null, "innererror" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + if (null != this._detail) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._detail ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("details",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.PowerShell.cs new file mode 100644 index 000000000000..fac214b6104a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorDetailsItemTypeConverter))] + public partial class ErrorResponseErrorDetailsItem + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponseErrorDetailsItem(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponseErrorDetailsItem(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponseErrorDetailsItem(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Target, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponseErrorDetailsItem(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Code = (string) content.GetValueForProperty("Code",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Code, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Target = (string) content.GetValueForProperty("Target",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal)this).Target, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorDetailsItemTypeConverter))] + public partial interface IErrorResponseErrorDetailsItem + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.TypeConverter.cs new file mode 100644 index 000000000000..8d018fff9ee7 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseErrorDetailsItemTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponseErrorDetailsItem.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponseErrorDetailsItem.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponseErrorDetailsItem.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.cs new file mode 100644 index 000000000000..689826b0b9d0 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.cs @@ -0,0 +1,77 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public partial class ErrorResponseErrorDetailsItem : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItemInternal + { + + /// Backing field for property. + private string _code; + + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Code { get => this._code; set => this._code = value; } + + /// Backing field for property. + private string _message; + + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private string _target; + + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Target { get => this._target; set => this._target = value; } + + /// Creates an new instance. + public ErrorResponseErrorDetailsItem() + { + + } + } + public partial interface IErrorResponseErrorDetailsItem : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Provides information about the error code. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error code.", + SerializedName = @"code", + PossibleTypes = new [] { typeof(string) })] + string Code { get; set; } + /// Provides information about the error message. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Provides information about the error target. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Provides information about the error target.", + SerializedName = @"target", + PossibleTypes = new [] { typeof(string) })] + string Target { get; set; } + + } + internal partial interface IErrorResponseErrorDetailsItemInternal + + { + /// Provides information about the error code. + string Code { get; set; } + /// Provides information about the error message. + string Message { get; set; } + /// Provides information about the error target. + string Target { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.json.cs new file mode 100644 index 000000000000..c360a51efbda --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorDetailsItem.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public partial class ErrorResponseErrorDetailsItem + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponseErrorDetailsItem(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_code = If( json?.PropertyT("code"), out var __jsonCode) ? (string)__jsonCode : (string)Code;} + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_target = If( json?.PropertyT("target"), out var __jsonTarget) ? (string)__jsonTarget : (string)Target;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorDetailsItem FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ErrorResponseErrorDetailsItem(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._code)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._code.ToString()) : null, "code" ,container.Add ); + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != (((object)this._target)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._target.ToString()) : null, "target" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.PowerShell.cs new file mode 100644 index 000000000000..09b48769f338 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.PowerShell.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Inner error object if present. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorInnererrorTypeConverter))] + public partial class ErrorResponseErrorInnererror + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ErrorResponseErrorInnererror(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ErrorResponseErrorInnererror(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ErrorResponseErrorInnererror(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ErrorResponseErrorInnererror(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Inner error object if present. + [System.ComponentModel.TypeConverter(typeof(ErrorResponseErrorInnererrorTypeConverter))] + public partial interface IErrorResponseErrorInnererror + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.TypeConverter.cs new file mode 100644 index 000000000000..255a19b9db27 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ErrorResponseErrorInnererrorTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ErrorResponseErrorInnererror.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ErrorResponseErrorInnererror.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ErrorResponseErrorInnererror.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.cs new file mode 100644 index 000000000000..4b35c78eaca1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Inner error object if present. + public partial class ErrorResponseErrorInnererror : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererrorInternal + { + + /// Creates an new instance. + public ErrorResponseErrorInnererror() + { + + } + } + /// Inner error object if present. + public partial interface IErrorResponseErrorInnererror : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + + } + /// Inner error object if present. + internal partial interface IErrorResponseErrorInnererrorInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.json.cs new file mode 100644 index 000000000000..64353038dc8c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ErrorResponseErrorInnererror.json.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Inner error object if present. + public partial class ErrorResponseErrorInnererror + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ErrorResponseErrorInnererror(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IErrorResponseErrorInnererror FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ErrorResponseErrorInnererror(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Export.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/Export.PowerShell.cs new file mode 100644 index 000000000000..7a8cab562d23 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Export.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + /// + [System.ComponentModel.TypeConverter(typeof(ExportTypeConverter))] + public partial class Export + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Export(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Export(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Export(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("BlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListblobPath = (string) content.GetValueForProperty("BlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Export(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("BlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListblobPath = (string) content.GetValueForProperty("BlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + [System.ComponentModel.TypeConverter(typeof(ExportTypeConverter))] + public partial interface IExport + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Export.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/Export.TypeConverter.cs new file mode 100644 index 000000000000..d61d73d25f09 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Export.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExportTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Export.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Export.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Export.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Export.cs b/src/ImportExport/generated/api/Models/Api20161101/Export.cs new file mode 100644 index 000000000000..1ba71a531a92 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Export.cs @@ -0,0 +1,100 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + /// + public partial class Export : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList _blobList; + + /// A list of the blobs to be exported. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList BlobList { get => (this._blobList = this._blobList ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobList()); set => this._blobList = value; } + + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)BlobList).BlobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)BlobList).BlobPath = value; } + + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPathPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)BlobList).BlobPathPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)BlobList).BlobPathPrefix = value; } + + /// Backing field for property. + private string _blobListblobPath; + + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string BlobListblobPath { get => this._blobListblobPath; set => this._blobListblobPath = value; } + + /// Internal Acessors for BlobList + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal.BlobList { get => (this._blobList = this._blobList ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobList()); set { {_blobList = value;} } } + + /// Creates an new instance. + public Export() + { + + } + } + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + public partial interface IExport : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPathPrefix { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ", + SerializedName = @"blobListblobPath", + PossibleTypes = new [] { typeof(string) })] + string BlobListblobPath { get; set; } + + } + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + internal partial interface IExportInternal + + { + /// A list of the blobs to be exported. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList BlobList { get; set; } + /// A collection of blob-path strings. + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + string[] BlobListBlobPathPrefix { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + string BlobListblobPath { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Export.json.cs b/src/ImportExport/generated/api/Models/Api20161101/Export.json.cs new file mode 100644 index 000000000000..57cce7eccad7 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Export.json.cs @@ -0,0 +1,106 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// A property containing information about the blobs to be exported for an export job. This property is required for export + /// jobs, but must not be specified for import jobs. + /// + public partial class Export + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal Export(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_blobList = If( json?.PropertyT("blobList"), out var __jsonBlobList) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobList.FromJson(__jsonBlobList) : BlobList;} + {_blobListblobPath = If( json?.PropertyT("blobListblobPath"), out var __jsonBlobListblobPath) ? (string)__jsonBlobListblobPath : (string)BlobListblobPath;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new Export(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._blobList ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._blobList.ToJson(null,serializationMode) : null, "blobList" ,container.Add ); + AddIf( null != (((object)this._blobListblobPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._blobListblobPath.ToString()) : null, "blobListblobPath" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.PowerShell.cs new file mode 100644 index 000000000000..c7feac1bca83 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// A list of the blobs to be exported. + [System.ComponentModel.TypeConverter(typeof(ExportBlobListTypeConverter))] + public partial class ExportBlobList + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ExportBlobList(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ExportBlobList(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ExportBlobList(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPath = (string[]) content.GetValueForProperty("BlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPathPrefix = (string[]) content.GetValueForProperty("BlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ExportBlobList(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPath = (string[]) content.GetValueForProperty("BlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPathPrefix = (string[]) content.GetValueForProperty("BlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal)this).BlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// A list of the blobs to be exported. + [System.ComponentModel.TypeConverter(typeof(ExportBlobListTypeConverter))] + public partial interface IExportBlobList + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.TypeConverter.cs new file mode 100644 index 000000000000..34a160193c65 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ExportBlobListTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ExportBlobList.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ExportBlobList.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ExportBlobList.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.cs b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.cs new file mode 100644 index 000000000000..636a61c5119f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// A list of the blobs to be exported. + public partial class ExportBlobList : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobListInternal + { + + /// Backing field for property. + private string[] _blobPath; + + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string[] BlobPath { get => this._blobPath; set => this._blobPath = value; } + + /// Backing field for property. + private string[] _blobPathPrefix; + + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string[] BlobPathPrefix { get => this._blobPathPrefix; set => this._blobPathPrefix = value; } + + /// Creates an new instance. + public ExportBlobList() + { + + } + } + /// A list of the blobs to be exported. + public partial interface IExportBlobList : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + string[] BlobPath { get; set; } + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + string[] BlobPathPrefix { get; set; } + + } + /// A list of the blobs to be exported. + internal partial interface IExportBlobListInternal + + { + /// A collection of blob-path strings. + string[] BlobPath { get; set; } + /// A collection of blob-prefix strings. + string[] BlobPathPrefix { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.json.cs new file mode 100644 index 000000000000..c4500fc1cb79 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ExportBlobList.json.cs @@ -0,0 +1,119 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// A list of the blobs to be exported. + public partial class ExportBlobList + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ExportBlobList(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_blobPath = If( json?.PropertyT("blobPath"), out var __jsonBlobPath) ? If( __jsonBlobPath as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : BlobPath;} + {_blobPathPrefix = If( json?.PropertyT("blobPathPrefix"), out var __jsonBlobPathPrefix) ? If( __jsonBlobPathPrefix as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : BlobPathPrefix;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ExportBlobList(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._blobPath) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._blobPath ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("blobPath",__w); + } + if (null != this._blobPathPrefix) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __s in this._blobPathPrefix ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("blobPathPrefix",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.PowerShell.cs new file mode 100644 index 000000000000..439b5682df32 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// GetBitLockerKeys response + [System.ComponentModel.TypeConverter(typeof(GetBitLockerKeysResponseTypeConverter))] + public partial class GetBitLockerKeysResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new GetBitLockerKeysResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new GetBitLockerKeysResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal GetBitLockerKeysResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveBitLockerKeyTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal GetBitLockerKeysResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveBitLockerKeyTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// GetBitLockerKeys response + [System.ComponentModel.TypeConverter(typeof(GetBitLockerKeysResponseTypeConverter))] + public partial interface IGetBitLockerKeysResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.TypeConverter.cs new file mode 100644 index 000000000000..dd1392a6c87c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class GetBitLockerKeysResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return GetBitLockerKeysResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return GetBitLockerKeysResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return GetBitLockerKeysResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.cs new file mode 100644 index 000000000000..4440331986f1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// GetBitLockerKeys response + public partial class GetBitLockerKeysResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponseInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[] _value; + + /// drive status + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public GetBitLockerKeysResponse() + { + + } + } + /// GetBitLockerKeys response + public partial interface IGetBitLockerKeysResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// drive status + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"drive status", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[] Value { get; set; } + + } + /// GetBitLockerKeys response + internal partial interface IGetBitLockerKeysResponseInternal + + { + /// drive status + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.json.cs new file mode 100644 index 000000000000..3f500bbaf427 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/GetBitLockerKeysResponse.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// GetBitLockerKeys response + public partial class GetBitLockerKeysResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IGetBitLockerKeysResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new GetBitLockerKeysResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal GetBitLockerKeysResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveBitLockerKey.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobDetails.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.PowerShell.cs new file mode 100644 index 000000000000..7d521d495fc9 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.PowerShell.cs @@ -0,0 +1,225 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the job properties + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial class JobDetails + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobDetails(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobDetails(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobDetails(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobDetails(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the job properties + [System.ComponentModel.TypeConverter(typeof(JobDetailsTypeConverter))] + public partial interface IJobDetails + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobDetails.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.TypeConverter.cs new file mode 100644 index 000000000000..69317d42c531 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobDetailsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobDetails.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobDetails.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobDetails.cs b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.cs new file mode 100644 index 000000000000..b95098a72070 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.cs @@ -0,0 +1,798 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the job properties + public partial class JobDetails : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal + { + + /// Backing field for property. + private bool? _backupDriveManifest; + + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public bool? BackupDriveManifest { get => this._backupDriveManifest; set => this._backupDriveManifest = value; } + + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListBlobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListBlobPath = value; } + + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPathPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListBlobPathPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListBlobPathPrefix = value; } + + /// Backing field for property. + private bool? _cancelRequested; + + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public bool? CancelRequested { get => this._cancelRequested; set => this._cancelRequested = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation _deliveryPackage; + + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set => this._deliveryPackage = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).CarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int DeliveryPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).DriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).DriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).ShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).ShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).TrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).TrackingNumber = value; } + + /// Backing field for property. + private string _diagnosticsPath; + + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string DiagnosticsPath { get => this._diagnosticsPath; set => this._diagnosticsPath = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] _driveList; + + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => this._driveList; set => this._driveList = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport _export; + + /// + /// A property containing information about the blobs to be exported for an export job. This property is included for export + /// jobs only. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Export { get => (this._export = this._export ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Export()); set => this._export = value; } + + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ExportBlobListblobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListblobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobListblobPath = value; } + + /// Backing field for property. + private string _incompleteBlobListUri; + + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string IncompleteBlobListUri { get => this._incompleteBlobListUri; set => this._incompleteBlobListUri = value; } + + /// Backing field for property. + private string _jobType; + + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string JobType { get => this._jobType; set => this._jobType = value; } + + /// Backing field for property. + private string _logLevel; + + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string LogLevel { get => this._logLevel; set => this._logLevel = value; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set { {_deliveryPackage = value;} } } + + /// Internal Acessors for Export + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.Export { get => (this._export = this._export ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Export()); set { {_export = value;} } } + + /// Internal Acessors for ExportBlobList + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.ExportBlobList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportInternal)Export).BlobList = value; } + + /// Internal Acessors for ReturnAddress + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.ReturnAddress { get => (this._returnAddress = this._returnAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress()); set { {_returnAddress = value;} } } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.ReturnPackage { get => (this._returnPackage = this._returnPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set { {_returnPackage = value;} } } + + /// Internal Acessors for ReturnShipping + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.ReturnShipping { get => (this._returnShipping = this._returnShipping ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping()); set { {_returnShipping = value;} } } + + /// Internal Acessors for ShippingInformation + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal.ShippingInformation { get => (this._shippingInformation = this._shippingInformation ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformation()); set { {_shippingInformation = value;} } } + + /// Backing field for property. + private int? _percentComplete; + + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public int? PercentComplete { get => this._percentComplete; set => this._percentComplete = value; } + + /// Backing field for property. + private string _provisioningState; + + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ProvisioningState { get => this._provisioningState; set => this._provisioningState = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress _returnAddress; + + /// Specifies the return address information for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get => (this._returnAddress = this._returnAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress()); set => this._returnAddress = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).City = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).CountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressEmail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Email; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Email = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Phone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).PostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).RecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).RecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress2 = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation _returnPackage; + + /// + /// Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. + /// The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet + /// been returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation ReturnPackage { get => (this._returnPackage = this._returnPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set => this._returnPackage = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).CarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int ReturnPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).DriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).DriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).ShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).ShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).TrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)ReturnPackage).TrackingNumber = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping _returnShipping; + + /// Specifies the return carrier and customer's account with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get => (this._returnShipping = this._returnShipping ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping()); set => this._returnShipping = value; } + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierAccountNumber = value; } + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierName = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation _shippingInformation; + + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation ShippingInformation { get => (this._shippingInformation = this._shippingInformation ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformation()); set => this._shippingInformation = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).City = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).CountryOrRegion = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).Phone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).PostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).RecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).RecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)ShippingInformation).StreetAddress2 = value; } + + /// Backing field for property. + private string _state; + + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Backing field for property. + private string _storageAccountId; + + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StorageAccountId { get => this._storageAccountId; set => this._storageAccountId = value; } + + /// Creates an new instance. + public JobDetails() + { + + } + } + /// Specifies the job properties + public partial interface IJobDetails : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(bool) })] + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether a request has been submitted to cancel the job.", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(bool) })] + bool? CancelRequested { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.", + SerializedName = @"diagnosticsPath", + PossibleTypes = new [] { typeof(string) })] + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ", + SerializedName = @"blobListblobPath", + PossibleTypes = new [] { typeof(string) })] + string ExportBlobListblobPath { get; set; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.", + SerializedName = @"incompleteBlobListUri", + PossibleTypes = new [] { typeof(string) })] + string IncompleteBlobListUri { get; set; } + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of job", + SerializedName = @"jobType", + PossibleTypes = new [] { typeof(string) })] + string JobType { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is Error. Indicates whether error logging or verbose logging will be enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + string LogLevel { get; set; } + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Overall percentage completed for the job.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + int? PercentComplete { get; set; } + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the provisioning state of the job.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress2 { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageTrackingNumber { get; set; } + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierName { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Current state of the job.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource identifier of the storage account where data will be imported to or exported from.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + + } + /// Specifies the job properties + internal partial interface IJobDetailsInternal + + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + bool? CancelRequested { get; set; } + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// A property containing information about the blobs to be exported for an export job. This property is included for export + /// jobs only. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Export { get; set; } + /// A list of the blobs to be exported. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList ExportBlobList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + string ExportBlobListblobPath { get; set; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + string IncompleteBlobListUri { get; set; } + /// The type of job + string JobType { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + string LogLevel { get; set; } + /// Overall percentage completed for the job. + int? PercentComplete { get; set; } + /// Specifies the provisioning state of the job. + string ProvisioningState { get; set; } + /// Specifies the return address information for the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get; set; } + /// The city name to use when returning the drives. + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ReturnAddressStreetAddress2 { get; set; } + /// + /// Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. + /// The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet + /// been returned. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation ReturnPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + string ReturnPackageTrackingNumber { get; set; } + /// Specifies the return carrier and customer's account with the carrier. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get; set; } + /// The customer's account number with the carrier. + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + string ReturnShippingCarrierName { get; set; } + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation ShippingInformation { get; set; } + /// The city name to use when returning the drives. + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + string StorageAccountId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobDetails.json.cs b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.json.cs new file mode 100644 index 000000000000..a3ed2a9e1c54 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobDetails.json.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the job properties + public partial class JobDetails + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new JobDetails(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal JobDetails(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deliveryPackage = If( json?.PropertyT("deliveryPackage"), out var __jsonDeliveryPackage) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation.FromJson(__jsonDeliveryPackage) : DeliveryPackage;} + {_export = If( json?.PropertyT("export"), out var __jsonExport) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Export.FromJson(__jsonExport) : Export;} + {_returnAddress = If( json?.PropertyT("returnAddress"), out var __jsonReturnAddress) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress.FromJson(__jsonReturnAddress) : ReturnAddress;} + {_returnPackage = If( json?.PropertyT("returnPackage"), out var __jsonReturnPackage) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation.FromJson(__jsonReturnPackage) : ReturnPackage;} + {_returnShipping = If( json?.PropertyT("returnShipping"), out var __jsonReturnShipping) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping.FromJson(__jsonReturnShipping) : ReturnShipping;} + {_shippingInformation = If( json?.PropertyT("shippingInformation"), out var __jsonShippingInformation) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformation.FromJson(__jsonShippingInformation) : ShippingInformation;} + {_backupDriveManifest = If( json?.PropertyT("backupDriveManifest"), out var __jsonBackupDriveManifest) ? (bool?)__jsonBackupDriveManifest : BackupDriveManifest;} + {_cancelRequested = If( json?.PropertyT("cancelRequested"), out var __jsonCancelRequested) ? (bool?)__jsonCancelRequested : CancelRequested;} + {_diagnosticsPath = If( json?.PropertyT("diagnosticsPath"), out var __jsonDiagnosticsPath) ? (string)__jsonDiagnosticsPath : (string)DiagnosticsPath;} + {_driveList = If( json?.PropertyT("driveList"), out var __jsonDriveList) ? If( __jsonDriveList as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus.FromJson(__u) )) ))() : null : DriveList;} + {_incompleteBlobListUri = If( json?.PropertyT("incompleteBlobListUri"), out var __jsonIncompleteBlobListUri) ? (string)__jsonIncompleteBlobListUri : (string)IncompleteBlobListUri;} + {_jobType = If( json?.PropertyT("jobType"), out var __jsonJobType) ? (string)__jsonJobType : (string)JobType;} + {_logLevel = If( json?.PropertyT("logLevel"), out var __jsonLogLevel) ? (string)__jsonLogLevel : (string)LogLevel;} + {_percentComplete = If( json?.PropertyT("percentComplete"), out var __jsonPercentComplete) ? (int?)__jsonPercentComplete : PercentComplete;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + {_storageAccountId = If( json?.PropertyT("storageAccountId"), out var __jsonStorageAccountId) ? (string)__jsonStorageAccountId : (string)StorageAccountId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._deliveryPackage ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._deliveryPackage.ToJson(null,serializationMode) : null, "deliveryPackage" ,container.Add ); + AddIf( null != this._export ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._export.ToJson(null,serializationMode) : null, "export" ,container.Add ); + AddIf( null != this._returnAddress ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._returnAddress.ToJson(null,serializationMode) : null, "returnAddress" ,container.Add ); + AddIf( null != this._returnPackage ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._returnPackage.ToJson(null,serializationMode) : null, "returnPackage" ,container.Add ); + AddIf( null != this._returnShipping ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._returnShipping.ToJson(null,serializationMode) : null, "returnShipping" ,container.Add ); + AddIf( null != this._shippingInformation ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._shippingInformation.ToJson(null,serializationMode) : null, "shippingInformation" ,container.Add ); + AddIf( null != this._backupDriveManifest ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonBoolean((bool)this._backupDriveManifest) : null, "backupDriveManifest" ,container.Add ); + AddIf( null != this._cancelRequested ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonBoolean((bool)this._cancelRequested) : null, "cancelRequested" ,container.Add ); + AddIf( null != (((object)this._diagnosticsPath)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._diagnosticsPath.ToString()) : null, "diagnosticsPath" ,container.Add ); + if (null != this._driveList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._driveList ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("driveList",__w); + } + AddIf( null != (((object)this._incompleteBlobListUri)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._incompleteBlobListUri.ToString()) : null, "incompleteBlobListUri" ,container.Add ); + AddIf( null != (((object)this._jobType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._jobType.ToString()) : null, "jobType" ,container.Add ); + AddIf( null != (((object)this._logLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._logLevel.ToString()) : null, "logLevel" ,container.Add ); + AddIf( null != this._percentComplete ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNumber((int)this._percentComplete) : null, "percentComplete" ,container.Add ); + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AddIf( null != (((object)this._storageAccountId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._storageAccountId.ToString()) : null, "storageAccountId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.PowerShell.cs new file mode 100644 index 000000000000..d1956a39e93f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.PowerShell.cs @@ -0,0 +1,237 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Contains the job information. + [System.ComponentModel.TypeConverter(typeof(JobResponseTypeConverter))] + public partial class JobResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Contains the job information. + [System.ComponentModel.TypeConverter(typeof(JobResponseTypeConverter))] + public partial interface IJobResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.TypeConverter.cs new file mode 100644 index 000000000000..9b3dbc67cf4a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.cs new file mode 100644 index 000000000000..506661d4077a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.cs @@ -0,0 +1,818 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Contains the job information. + public partial class JobResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal + { + + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? BackupDriveManifest { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BackupDriveManifest; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BackupDriveManifest = value; } + + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPath = value; } + + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPathPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPathPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPathPrefix = value; } + + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? CancelRequested { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).CancelRequested; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).CancelRequested = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int DeliveryPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageDriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageTrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageTrackingNumber = value; } + + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DiagnosticsPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DiagnosticsPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DiagnosticsPath = value; } + + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DriveList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DriveList = value; } + + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ExportBlobListblobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobListblobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobListblobPath = value; } + + /// Backing field for property. + private string _id; + + /// Specifies the resource identifier of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string IncompleteBlobListUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).IncompleteBlobListUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).IncompleteBlobListUri = value; } + + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string JobType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).JobType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).JobType = value; } + + /// Backing field for property. + private string _location; + + /// Specifies the Azure location where the job is created. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string LogLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).LogLevel; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).LogLevel = value; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackage = value; } + + /// Internal Acessors for Export + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.Export { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).Export; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).Export = value; } + + /// Internal Acessors for ExportBlobList + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.ExportBlobList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobList = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails()); set { {_property = value;} } } + + /// Internal Acessors for ReturnAddress + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.ReturnAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddress = value; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackage = value; } + + /// Internal Acessors for ReturnShipping + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.ReturnShipping { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShipping; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShipping = value; } + + /// Internal Acessors for ShippingInformation + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.ShippingInformation { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformation; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformation = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// Specifies the name of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int? PercentComplete { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).PercentComplete; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).PercentComplete = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails _property; + + /// Specifies the job properties + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails()); set => this._property = value; } + + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ProvisioningState = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressEmail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressEmail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressRecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress2 = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageCarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int ReturnPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageDriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageDriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageTrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageTrackingNumber = value; } + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierName = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCity = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCountryOrRegion = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPhone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationRecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationRecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress2 = value; } + + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).State = value; } + + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string StorageAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).StorageAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).StorageAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags _tag; + + /// Specifies the tags that are assigned to the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTags()); set => this._tag = value; } + + /// Backing field for property. + private string _type; + + /// Specifies the type of the job resource. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public JobResponse() + { + + } + } + /// Contains the job information. + public partial interface IJobResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(bool) })] + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether a request has been submitted to cancel the job.", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(bool) })] + bool? CancelRequested { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.", + SerializedName = @"diagnosticsPath", + PossibleTypes = new [] { typeof(string) })] + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ", + SerializedName = @"blobListblobPath", + PossibleTypes = new [] { typeof(string) })] + string ExportBlobListblobPath { get; set; } + /// Specifies the resource identifier of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the resource identifier of the job.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.", + SerializedName = @"incompleteBlobListUri", + PossibleTypes = new [] { typeof(string) })] + string IncompleteBlobListUri { get; set; } + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of job", + SerializedName = @"jobType", + PossibleTypes = new [] { typeof(string) })] + string JobType { get; set; } + /// Specifies the Azure location where the job is created. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the Azure location where the job is created.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is Error. Indicates whether error logging or verbose logging will be enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + string LogLevel { get; set; } + /// Specifies the name of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the name of the job.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Overall percentage completed for the job.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + int? PercentComplete { get; set; } + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the provisioning state of the job.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress2 { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageTrackingNumber { get; set; } + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierName { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Current state of the job.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource identifier of the storage account where data will be imported to or exported from.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// Specifies the tags that are assigned to the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that are assigned to the job.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags Tag { get; set; } + /// Specifies the type of the job resource. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Specifies the type of the job resource.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// Contains the job information. + internal partial interface IJobResponseInternal + + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + bool? CancelRequested { get; set; } + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// A property containing information about the blobs to be exported for an export job. This property is included for export + /// jobs only. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Export { get; set; } + /// A list of the blobs to be exported. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList ExportBlobList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + string ExportBlobListblobPath { get; set; } + /// Specifies the resource identifier of the job. + string Id { get; set; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + string IncompleteBlobListUri { get; set; } + /// The type of job + string JobType { get; set; } + /// Specifies the Azure location where the job is created. + string Location { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + string LogLevel { get; set; } + /// Specifies the name of the job. + string Name { get; set; } + /// Overall percentage completed for the job. + int? PercentComplete { get; set; } + /// Specifies the job properties + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Property { get; set; } + /// Specifies the provisioning state of the job. + string ProvisioningState { get; set; } + /// Specifies the return address information for the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get; set; } + /// The city name to use when returning the drives. + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ReturnAddressStreetAddress2 { get; set; } + /// + /// Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. + /// The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet + /// been returned. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation ReturnPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + string ReturnPackageTrackingNumber { get; set; } + /// Specifies the return carrier and customer's account with the carrier. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get; set; } + /// The customer's account number with the carrier. + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + string ReturnShippingCarrierName { get; set; } + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation ShippingInformation { get; set; } + /// The city name to use when returning the drives. + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + string StorageAccountId { get; set; } + /// Specifies the tags that are assigned to the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags Tag { get; set; } + /// Specifies the type of the job resource. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.json.cs new file mode 100644 index 000000000000..a3a4dd3777b1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponse.json.cs @@ -0,0 +1,120 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Contains the job information. + public partial class JobResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new JobResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal JobResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.PowerShell.cs new file mode 100644 index 000000000000..3375658fff02 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.PowerShell.cs @@ -0,0 +1,129 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the tags that are assigned to the job. + [System.ComponentModel.TypeConverter(typeof(JobResponseTagsTypeConverter))] + public partial class JobResponseTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new JobResponseTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new JobResponseTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal JobResponseTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal JobResponseTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the tags that are assigned to the job. + [System.ComponentModel.TypeConverter(typeof(JobResponseTagsTypeConverter))] + public partial interface IJobResponseTags + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.TypeConverter.cs new file mode 100644 index 000000000000..b55fc38b785c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class JobResponseTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return JobResponseTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return JobResponseTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return JobResponseTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.cs new file mode 100644 index 000000000000..bfbb32478c96 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that are assigned to the job. + public partial class JobResponseTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTagsInternal + { + + /// Creates an new instance. + public JobResponseTags() + { + + } + } + /// Specifies the tags that are assigned to the job. + public partial interface IJobResponseTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + + } + /// Specifies the tags that are assigned to the job. + internal partial interface IJobResponseTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.json.cs b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.json.cs new file mode 100644 index 000000000000..816696d96d6d --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/JobResponseTags.json.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that are assigned to the job. + public partial class JobResponseTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponseTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new JobResponseTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal JobResponseTags(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.PowerShell.cs new file mode 100644 index 000000000000..f8a209de4ed5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// List jobs response + [System.ComponentModel.TypeConverter(typeof(ListJobsResponseTypeConverter))] + public partial class ListJobsResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ListJobsResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ListJobsResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ListJobsResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ListJobsResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponseTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List jobs response + [System.ComponentModel.TypeConverter(typeof(ListJobsResponseTypeConverter))] + public partial interface IListJobsResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.TypeConverter.cs new file mode 100644 index 000000000000..86ab0355e7b2 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ListJobsResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ListJobsResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ListJobsResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ListJobsResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.cs new file mode 100644 index 000000000000..c23f92985b65 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// List jobs response + public partial class ListJobsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponseInternal + { + + /// Backing field for property. + private string _nextLink; + + /// link to next batch of jobs + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[] _value; + + /// Job list + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ListJobsResponse() + { + + } + } + /// List jobs response + public partial interface IListJobsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// link to next batch of jobs + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"link to next batch of jobs", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Job list + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Job list", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[] Value { get; set; } + + } + /// List jobs response + internal partial interface IListJobsResponseInternal + + { + /// link to next batch of jobs + string NextLink { get; set; } + /// Job list + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.json.cs new file mode 100644 index 000000000000..08882e154734 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListJobsResponse.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// List jobs response + public partial class ListJobsResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListJobsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ListJobsResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ListJobsResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobResponse.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.PowerShell.cs new file mode 100644 index 000000000000..7d7fbf73fb9e --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// List operations response + [System.ComponentModel.TypeConverter(typeof(ListOperationsResponseTypeConverter))] + public partial class ListOperationsResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ListOperationsResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ListOperationsResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ListOperationsResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ListOperationsResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// List operations response + [System.ComponentModel.TypeConverter(typeof(ListOperationsResponseTypeConverter))] + public partial interface IListOperationsResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.TypeConverter.cs new file mode 100644 index 000000000000..eeba74d3f676 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ListOperationsResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ListOperationsResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ListOperationsResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ListOperationsResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.cs new file mode 100644 index 000000000000..19a46a206fec --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// List operations response + public partial class ListOperationsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponseInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[] _value; + + /// operations + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ListOperationsResponse() + { + + } + } + /// List operations response + public partial interface IListOperationsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// operations + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"operations", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[] Value { get; set; } + + } + /// List operations response + internal partial interface IListOperationsResponseInternal + + { + /// operations + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.json.cs new file mode 100644 index 000000000000..f50e23fcfd83 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ListOperationsResponse.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// List operations response + public partial class ListOperationsResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IListOperationsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ListOperationsResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ListOperationsResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Operation.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Location.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/Location.PowerShell.cs new file mode 100644 index 000000000000..0bcd79d72a0f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Location.PowerShell.cs @@ -0,0 +1,157 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Provides information about an Azure data center location. + [System.ComponentModel.TypeConverter(typeof(LocationTypeConverter))] + public partial class Location + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Location(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Location(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Location(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).AlternateLocation = (string[]) content.GetValueForProperty("AlternateLocation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).AlternateLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).SupportedCarrier = (string[]) content.GetValueForProperty("SupportedCarrier",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).SupportedCarrier, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Location(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).AlternateLocation = (string[]) content.GetValueForProperty("AlternateLocation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).AlternateLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).StreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).SupportedCarrier = (string[]) content.GetValueForProperty("SupportedCarrier",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal)this).SupportedCarrier, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Provides information about an Azure data center location. + [System.ComponentModel.TypeConverter(typeof(LocationTypeConverter))] + public partial interface ILocation + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Location.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/Location.TypeConverter.cs new file mode 100644 index 000000000000..ad4e68448f66 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Location.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LocationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Location.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Location.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Location.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Location.cs b/src/ImportExport/generated/api/Models/Api20161101/Location.cs new file mode 100644 index 000000000000..e31265672e6f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Location.cs @@ -0,0 +1,274 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Provides information about an Azure data center location. + public partial class Location : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal + { + + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] AlternateLocation { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).AlternateLocation; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).AlternateLocation = value; } + + /// The city name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string City { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).City = value; } + + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string CountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).CountryOrRegion = value; } + + /// Backing field for property. + private string _id; + + /// Specifies the resource identifier of the location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationProperties()); set { {_property = value;} } } + + /// Backing field for property. + private string _name; + + /// + /// Specifies the name of the location. Use List Locations to get all supported locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// The phone number for the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string Phone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).Phone = value; } + + /// The postal code to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string PostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).PostalCode = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties _property; + + /// location properties + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationProperties()); set => this._property = value; } + + /// The recipient name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string RecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).RecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).RecipientName = value; } + + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string StateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StateOrProvince = value; } + + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string StreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StreetAddress1 = value; } + + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string StreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).StreetAddress2 = value; } + + /// A list of carriers that are supported at this location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] SupportedCarrier { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).SupportedCarrier; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)Property).SupportedCarrier = value; } + + /// Backing field for property. + private string _type; + + /// Specifies the type of the location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public Location() + { + + } + } + /// Provides information about an Azure data center location. + public partial interface ILocation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list may contain other locations. ", + SerializedName = @"alternateLocations", + PossibleTypes = new [] { typeof(string) })] + string[] AlternateLocation { get; set; } + /// The city name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when shipping the drives to the Azure data center. ", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when shipping the drives to the Azure data center. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string CountryOrRegion { get; set; } + /// Specifies the resource identifier of the location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the resource identifier of the location. ", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// + /// Specifies the name of the location. Use List Locations to get all supported locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the name of the location. Use List Locations to get all supported locations. ", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// The phone number for the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The phone number for the Azure data center. ", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// The postal code to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when shipping the drives to the Azure data center. ", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// The recipient name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recipient name to use when shipping the drives to the Azure data center. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string RecipientName { get; set; } + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when shipping the drives to the Azure data center. ", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when shipping the drives to the Azure data center. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when shipping the drives to the Azure data center. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + /// A list of carriers that are supported at this location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of carriers that are supported at this location. ", + SerializedName = @"supportedCarriers", + PossibleTypes = new [] { typeof(string) })] + string[] SupportedCarrier { get; set; } + /// Specifies the type of the location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the type of the location. ", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Provides information about an Azure data center location. + internal partial interface ILocationInternal + + { + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + string[] AlternateLocation { get; set; } + /// The city name to use when shipping the drives to the Azure data center. + string City { get; set; } + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + string CountryOrRegion { get; set; } + /// Specifies the resource identifier of the location. + string Id { get; set; } + /// + /// Specifies the name of the location. Use List Locations to get all supported locations. + /// + string Name { get; set; } + /// The phone number for the Azure data center. + string Phone { get; set; } + /// The postal code to use when shipping the drives to the Azure data center. + string PostalCode { get; set; } + /// location properties + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties Property { get; set; } + /// The recipient name to use when shipping the drives to the Azure data center. + string RecipientName { get; set; } + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + string StateOrProvince { get; set; } + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + string StreetAddress1 { get; set; } + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + string StreetAddress2 { get; set; } + /// A list of carriers that are supported at this location. + string[] SupportedCarrier { get; set; } + /// Specifies the type of the location. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Location.json.cs b/src/ImportExport/generated/api/Models/Api20161101/Location.json.cs new file mode 100644 index 000000000000..e7c0e27386a6 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Location.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Provides information about an Azure data center location. + public partial class Location + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new Location(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal Location(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationProperties.FromJson(__jsonProperties) : Property;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.PowerShell.cs new file mode 100644 index 000000000000..384ab7278195 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.PowerShell.cs @@ -0,0 +1,149 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// location properties + [System.ComponentModel.TypeConverter(typeof(LocationPropertiesTypeConverter))] + public partial class LocationProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LocationProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LocationProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LocationProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).AlternateLocation = (string[]) content.GetValueForProperty("AlternateLocation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).AlternateLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).SupportedCarrier = (string[]) content.GetValueForProperty("SupportedCarrier",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).SupportedCarrier, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LocationProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).AlternateLocation = (string[]) content.GetValueForProperty("AlternateLocation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).AlternateLocation, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).StreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).SupportedCarrier = (string[]) content.GetValueForProperty("SupportedCarrier",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal)this).SupportedCarrier, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// location properties + [System.ComponentModel.TypeConverter(typeof(LocationPropertiesTypeConverter))] + public partial interface ILocationProperties + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.TypeConverter.cs new file mode 100644 index 000000000000..4b3179758ed5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LocationPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LocationProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LocationProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LocationProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.cs new file mode 100644 index 000000000000..f951f83248a9 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.cs @@ -0,0 +1,235 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// location properties + public partial class LocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationPropertiesInternal + { + + /// Backing field for property. + private string[] _alternateLocation; + + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string[] AlternateLocation { get => this._alternateLocation; set => this._alternateLocation = value; } + + /// Backing field for property. + private string _city; + + /// The city name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string City { get => this._city; set => this._city = value; } + + /// Backing field for property. + private string _countryOrRegion; + + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CountryOrRegion { get => this._countryOrRegion; set => this._countryOrRegion = value; } + + /// Backing field for property. + private string _phone; + + /// The phone number for the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private string _postalCode; + + /// The postal code to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string PostalCode { get => this._postalCode; set => this._postalCode = value; } + + /// Backing field for property. + private string _recipientName; + + /// The recipient name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string RecipientName { get => this._recipientName; set => this._recipientName = value; } + + /// Backing field for property. + private string _stateOrProvince; + + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StateOrProvince { get => this._stateOrProvince; set => this._stateOrProvince = value; } + + /// Backing field for property. + private string _streetAddress1; + + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress1 { get => this._streetAddress1; set => this._streetAddress1 = value; } + + /// Backing field for property. + private string _streetAddress2; + + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress2 { get => this._streetAddress2; set => this._streetAddress2 = value; } + + /// Backing field for property. + private string[] _supportedCarrier; + + /// A list of carriers that are supported at this location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string[] SupportedCarrier { get => this._supportedCarrier; set => this._supportedCarrier = value; } + + /// Creates an new instance. + public LocationProperties() + { + + } + } + /// location properties + public partial interface ILocationProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list may contain other locations. ", + SerializedName = @"alternateLocations", + PossibleTypes = new [] { typeof(string) })] + string[] AlternateLocation { get; set; } + /// The city name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when shipping the drives to the Azure data center. ", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when shipping the drives to the Azure data center. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string CountryOrRegion { get; set; } + /// The phone number for the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The phone number for the Azure data center. ", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// The postal code to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when shipping the drives to the Azure data center. ", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// The recipient name to use when shipping the drives to the Azure data center. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The recipient name to use when shipping the drives to the Azure data center. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string RecipientName { get; set; } + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when shipping the drives to the Azure data center. ", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when shipping the drives to the Azure data center. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when shipping the drives to the Azure data center. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + /// A list of carriers that are supported at this location. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A list of carriers that are supported at this location. ", + SerializedName = @"supportedCarriers", + PossibleTypes = new [] { typeof(string) })] + string[] SupportedCarrier { get; set; } + + } + /// location properties + internal partial interface ILocationPropertiesInternal + + { + /// + /// A list of location IDs that should be used to ship shipping drives to for jobs created against the current location. If + /// the current location is active, it will be part of the list. If it is temporarily closed due to maintenance, this list + /// may contain other locations. + /// + string[] AlternateLocation { get; set; } + /// The city name to use when shipping the drives to the Azure data center. + string City { get; set; } + /// + /// The country or region to use when shipping the drives to the Azure data center. + /// + string CountryOrRegion { get; set; } + /// The phone number for the Azure data center. + string Phone { get; set; } + /// The postal code to use when shipping the drives to the Azure data center. + string PostalCode { get; set; } + /// The recipient name to use when shipping the drives to the Azure data center. + string RecipientName { get; set; } + /// + /// The state or province to use when shipping the drives to the Azure data center. + /// + string StateOrProvince { get; set; } + /// + /// The first line of the street address to use when shipping the drives to the Azure data center. + /// + string StreetAddress1 { get; set; } + /// + /// The second line of the street address to use when shipping the drives to the Azure data center. + /// + string StreetAddress2 { get; set; } + /// A list of carriers that are supported at this location. + string[] SupportedCarrier { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.json.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.json.cs new file mode 100644 index 000000000000..405f372b9b0c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationProperties.json.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// location properties + public partial class LocationProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new LocationProperties(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal LocationProperties(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_alternateLocation = If( json?.PropertyT("alternateLocations"), out var __jsonAlternateLocations) ? If( __jsonAlternateLocations as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : AlternateLocation;} + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)City;} + {_countryOrRegion = If( json?.PropertyT("countryOrRegion"), out var __jsonCountryOrRegion) ? (string)__jsonCountryOrRegion : (string)CountryOrRegion;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)Phone;} + {_postalCode = If( json?.PropertyT("postalCode"), out var __jsonPostalCode) ? (string)__jsonPostalCode : (string)PostalCode;} + {_recipientName = If( json?.PropertyT("recipientName"), out var __jsonRecipientName) ? (string)__jsonRecipientName : (string)RecipientName;} + {_stateOrProvince = If( json?.PropertyT("stateOrProvince"), out var __jsonStateOrProvince) ? (string)__jsonStateOrProvince : (string)StateOrProvince;} + {_streetAddress1 = If( json?.PropertyT("streetAddress1"), out var __jsonStreetAddress1) ? (string)__jsonStreetAddress1 : (string)StreetAddress1;} + {_streetAddress2 = If( json?.PropertyT("streetAddress2"), out var __jsonStreetAddress2) ? (string)__jsonStreetAddress2 : (string)StreetAddress2;} + {_supportedCarrier = If( json?.PropertyT("supportedCarriers"), out var __jsonSupportedCarriers) ? If( __jsonSupportedCarriers as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : SupportedCarrier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._alternateLocation) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._alternateLocation ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("alternateLocations",__w); + } + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + AddIf( null != (((object)this._countryOrRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._countryOrRegion.ToString()) : null, "countryOrRegion" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AddIf( null != (((object)this._postalCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._postalCode.ToString()) : null, "postalCode" ,container.Add ); + AddIf( null != (((object)this._recipientName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._recipientName.ToString()) : null, "recipientName" ,container.Add ); + AddIf( null != (((object)this._stateOrProvince)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._stateOrProvince.ToString()) : null, "stateOrProvince" ,container.Add ); + AddIf( null != (((object)this._streetAddress1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress1.ToString()) : null, "streetAddress1" ,container.Add ); + AddIf( null != (((object)this._streetAddress2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress2.ToString()) : null, "streetAddress2" ,container.Add ); + if (null != this._supportedCarrier) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __s in this._supportedCarrier ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("supportedCarriers",__r); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.PowerShell.cs new file mode 100644 index 000000000000..3b33437a7016 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.PowerShell.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Locations response + [System.ComponentModel.TypeConverter(typeof(LocationsResponseTypeConverter))] + public partial class LocationsResponse + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new LocationsResponse(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new LocationsResponse(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal LocationsResponse(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal LocationsResponse(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponseInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponseInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.LocationTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Locations response + [System.ComponentModel.TypeConverter(typeof(LocationsResponseTypeConverter))] + public partial interface ILocationsResponse + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.TypeConverter.cs new file mode 100644 index 000000000000..70f86bd84b46 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class LocationsResponseTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return LocationsResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return LocationsResponse.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return LocationsResponse.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.cs new file mode 100644 index 000000000000..1d89694c44ba --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Locations response + public partial class LocationsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponseInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[] _value; + + /// locations + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public LocationsResponse() + { + + } + } + /// Locations response + public partial interface ILocationsResponse : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// locations + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"locations", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[] Value { get; set; } + + } + /// Locations response + internal partial interface ILocationsResponseInternal + + { + /// locations + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.json.cs b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.json.cs new file mode 100644 index 000000000000..c3653eb5e3e7 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/LocationsResponse.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Locations response + public partial class LocationsResponse + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocationsResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new LocationsResponse(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal LocationsResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.Location.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Operation.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/Operation.PowerShell.cs new file mode 100644 index 000000000000..e5d97847545c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Operation.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Describes a supported operation by the Storage Import/Export job API. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial class Operation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Operation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Operation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Operation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Operation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Describes a supported operation by the Storage Import/Export job API. + [System.ComponentModel.TypeConverter(typeof(OperationTypeConverter))] + public partial interface IOperation + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Operation.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/Operation.TypeConverter.cs new file mode 100644 index 000000000000..2c864ea2fdd8 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Operation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Operation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Operation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Operation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Operation.cs b/src/ImportExport/generated/api/Models/Api20161101/Operation.cs new file mode 100644 index 000000000000..c16b761aa933 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Operation.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Describes a supported operation by the Storage Import/Export job API. + public partial class Operation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay _display; + + /// operation display properties + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplay()); set => this._display = value; } + + /// Short description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Description = value; } + + /// The display name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Operation = value; } + + /// The resource provider name to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Provider = value; } + + /// The name of the resource to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)Display).Resource = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplay()); set { {_display = value;} } } + + /// Backing field for property. + private string _name; + + /// Name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Creates an new instance. + public Operation() + { + + } + } + /// Describes a supported operation by the Storage Import/Export job API. + public partial interface IOperation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Short description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Short description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// The display name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The display name of the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// The resource provider name to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource provider name to which the operation belongs.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// The name of the resource to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource to which the operation belongs.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// Name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Name of the operation.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + + } + /// Describes a supported operation by the Storage Import/Export job API. + internal partial interface IOperationInternal + + { + /// operation display properties + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay Display { get; set; } + /// Short description of the operation. + string DisplayDescription { get; set; } + /// The display name of the operation. + string DisplayOperation { get; set; } + /// The resource provider name to which the operation belongs. + string DisplayProvider { get; set; } + /// The name of the resource to which the operation belongs. + string DisplayResource { get; set; } + /// Name of the operation. + string Name { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/Operation.json.cs b/src/ImportExport/generated/api/Models/Api20161101/Operation.json.cs new file mode 100644 index 000000000000..148b8de0f3b5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/Operation.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Describes a supported operation by the Storage Import/Export job API. + public partial class Operation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new Operation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal Operation(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.OperationDisplay.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.PowerShell.cs new file mode 100644 index 000000000000..b027c6cefc3d --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// operation display properties + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial class OperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// operation display properties + [System.ComponentModel.TypeConverter(typeof(OperationDisplayTypeConverter))] + public partial interface IOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.TypeConverter.cs new file mode 100644 index 000000000000..f29b65650fbc --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.cs b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.cs new file mode 100644 index 000000000000..833bd8ec651a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.cs @@ -0,0 +1,97 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// operation display properties + public partial class OperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// Short description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// The display name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// The resource provider name to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// The name of the resource to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public OperationDisplay() + { + + } + } + /// operation display properties + public partial interface IOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Short description of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Short description of the operation.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// The display name of the operation. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The display name of the operation.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// The resource provider name to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource provider name to which the operation belongs.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// The name of the resource to which the operation belongs. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource to which the operation belongs.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// operation display properties + internal partial interface IOperationDisplayInternal + + { + /// Short description of the operation. + string Description { get; set; } + /// The display name of the operation. + string Operation { get; set; } + /// The resource provider name to which the operation belongs. + string Provider { get; set; } + /// The name of the resource to which the operation belongs. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.json.cs b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.json.cs new file mode 100644 index 000000000000..8e0b756326d1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/OperationDisplay.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// operation display properties + public partial class OperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new OperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal OperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.PowerShell.cs new file mode 100644 index 000000000000..706a37b460a0 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + [System.ComponentModel.TypeConverter(typeof(PackageInfomationTypeConverter))] + public partial class PackageInfomation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PackageInfomation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PackageInfomation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PackageInfomation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).CarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).DriveCount = (int) content.GetValueForProperty("DriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).DriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).ShipDate = (string) content.GetValueForProperty("ShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).ShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).TrackingNumber = (string) content.GetValueForProperty("TrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).TrackingNumber, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PackageInfomation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).CarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).DriveCount = (int) content.GetValueForProperty("DriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).DriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).ShipDate = (string) content.GetValueForProperty("ShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).ShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).TrackingNumber = (string) content.GetValueForProperty("TrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)this).TrackingNumber, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Contains information about the package being shipped by the customer to the Microsoft data center. + [System.ComponentModel.TypeConverter(typeof(PackageInfomationTypeConverter))] + public partial interface IPackageInfomation + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.TypeConverter.cs new file mode 100644 index 000000000000..814a8305fd9f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PackageInfomationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PackageInfomation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PackageInfomation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PackageInfomation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.cs b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.cs new file mode 100644 index 000000000000..795b4ae50e86 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + public partial class PackageInfomation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal + { + + /// Backing field for property. + private string _carrierName; + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CarrierName { get => this._carrierName; set => this._carrierName = value; } + + /// Backing field for property. + private int _driveCount; + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public int DriveCount { get => this._driveCount; set => this._driveCount = value; } + + /// Backing field for property. + private string _shipDate; + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ShipDate { get => this._shipDate; set => this._shipDate = value; } + + /// Backing field for property. + private string _trackingNumber; + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string TrackingNumber { get => this._trackingNumber; set => this._trackingNumber = value; } + + /// Creates an new instance. + public PackageInfomation() + { + + } + } + /// Contains information about the package being shipped by the customer to the Microsoft data center. + public partial interface IPackageInfomation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string CarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string ShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string TrackingNumber { get; set; } + + } + /// Contains information about the package being shipped by the customer to the Microsoft data center. + internal partial interface IPackageInfomationInternal + + { + /// The name of the carrier that is used to ship the import or export drives. + string CarrierName { get; set; } + /// The number of drives included in the package. + int DriveCount { get; set; } + /// The date when the package is shipped. + string ShipDate { get; set; } + /// The tracking number of the package. + string TrackingNumber { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.json.cs b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.json.cs new file mode 100644 index 000000000000..96b64b0a2f6c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PackageInfomation.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + public partial class PackageInfomation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new PackageInfomation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal PackageInfomation(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_carrierName = If( json?.PropertyT("carrierName"), out var __jsonCarrierName) ? (string)__jsonCarrierName : (string)CarrierName;} + {_driveCount = If( json?.PropertyT("driveCount"), out var __jsonDriveCount) ? (int)__jsonDriveCount : DriveCount;} + {_shipDate = If( json?.PropertyT("shipDate"), out var __jsonShipDate) ? (string)__jsonShipDate : (string)ShipDate;} + {_trackingNumber = If( json?.PropertyT("trackingNumber"), out var __jsonTrackingNumber) ? (string)__jsonTrackingNumber : (string)TrackingNumber;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._carrierName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._carrierName.ToString()) : null, "carrierName" ,container.Add ); + AddIf( (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNumber(this._driveCount), "driveCount" ,container.Add ); + AddIf( null != (((object)this._shipDate)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._shipDate.ToString()) : null, "shipDate" ,container.Add ); + AddIf( null != (((object)this._trackingNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._trackingNumber.ToString()) : null, "trackingNumber" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.PowerShell.cs new file mode 100644 index 000000000000..37de12bb17b1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.PowerShell.cs @@ -0,0 +1,231 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Put Job parameters + [System.ComponentModel.TypeConverter(typeof(PutJobParametersTypeConverter))] + public partial class PutJobParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PutJobParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PutJobParameters(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PutJobParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PutJobParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetailsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformation = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation) content.GetValueForProperty("ShippingInformation",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformation, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ShippingInformationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Export = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport) content.GetValueForProperty("Export",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).Export, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("ReturnPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DiagnosticsPath = (string) content.GetValueForProperty("DiagnosticsPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DiagnosticsPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).IncompleteBlobListUri = (string) content.GetValueForProperty("IncompleteBlobListUri",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).IncompleteBlobListUri, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).JobType = (string) content.GetValueForProperty("JobType",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).JobType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).PercentComplete = (int?) content.GetValueForProperty("PercentComplete",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).PercentComplete, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ProvisioningState = (string) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ProvisioningState, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).StorageAccountId = (string) content.GetValueForProperty("StorageAccountId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).StorageAccountId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress1 = (string) content.GetValueForProperty("ShippingInformationStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList) content.GetValueForProperty("ExportBlobList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobList, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ExportBlobListTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCity = (string) content.GetValueForProperty("ShippingInformationCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPhone = (string) content.GetValueForProperty("ShippingInformationPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPostalCode = (string) content.GetValueForProperty("ShippingInformationPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationRecipientName = (string) content.GetValueForProperty("ShippingInformationRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageCarrierName = (string) content.GetValueForProperty("ReturnPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageDriveCount = (int) content.GetValueForProperty("ReturnPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageShipDate = (string) content.GetValueForProperty("ReturnPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageTrackingNumber = (string) content.GetValueForProperty("ReturnPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCountryOrRegion = (string) content.GetValueForProperty("ShippingInformationCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobListblobPath = (string) content.GetValueForProperty("ExportBlobListblobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ExportBlobListblobPath, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPath = (string[]) content.GetValueForProperty("BlobListBlobPath",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPath, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStateOrProvince = (string) content.GetValueForProperty("ShippingInformationStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress2 = (string) content.GetValueForProperty("ShippingInformationStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).ShippingInformationStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPathPrefix = (string[]) content.GetValueForProperty("BlobListBlobPathPrefix",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal)this).BlobListBlobPathPrefix, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Put Job parameters + [System.ComponentModel.TypeConverter(typeof(PutJobParametersTypeConverter))] + public partial interface IPutJobParameters + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.TypeConverter.cs new file mode 100644 index 000000000000..e21aba150170 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PutJobParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PutJobParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PutJobParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PutJobParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.cs new file mode 100644 index 000000000000..ad168ece5940 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.cs @@ -0,0 +1,758 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Put Job parameters + public partial class PutJobParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal + { + + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? BackupDriveManifest { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BackupDriveManifest; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BackupDriveManifest = value; } + + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPath = value; } + + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string[] BlobListBlobPathPrefix { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPathPrefix; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).BlobListBlobPathPrefix = value; } + + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? CancelRequested { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).CancelRequested; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).CancelRequested = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int DeliveryPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageDriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageTrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackageTrackingNumber = value; } + + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DiagnosticsPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DiagnosticsPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DiagnosticsPath = value; } + + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DriveList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DriveList = value; } + + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ExportBlobListblobPath { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobListblobPath; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobListblobPath = value; } + + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string IncompleteBlobListUri { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).IncompleteBlobListUri; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).IncompleteBlobListUri = value; } + + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string JobType { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).JobType; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).JobType = value; } + + /// Backing field for property. + private string _location; + + /// Specifies the supported Azure location where the job should be created + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string LogLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).LogLevel; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).LogLevel = value; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).DeliveryPackage = value; } + + /// Internal Acessors for Export + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.Export { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).Export; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).Export = value; } + + /// Internal Acessors for ExportBlobList + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.ExportBlobList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ExportBlobList = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails()); set { {_property = value;} } } + + /// Internal Acessors for ReturnAddress + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.ReturnAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddress = value; } + + /// Internal Acessors for ReturnPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.ReturnPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackage = value; } + + /// Internal Acessors for ReturnShipping + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.ReturnShipping { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShipping; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShipping = value; } + + /// Internal Acessors for ShippingInformation + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersInternal.ShippingInformation { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformation; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformation = value; } + + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int? PercentComplete { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).PercentComplete; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).PercentComplete = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails _property; + + /// Specifies the job properties + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails()); set => this._property = value; } + + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ProvisioningState = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressEmail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressEmail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressRecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnAddressStreetAddress2 = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageCarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int ReturnPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageDriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageDriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageTrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnPackageTrackingNumber = value; } + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ReturnShippingCarrierName = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCity = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationCountryOrRegion = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPhone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationRecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationRecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ShippingInformationStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).ShippingInformationStreetAddress2 = value; } + + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).State = value; } + + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string StorageAccountId { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).StorageAccountId; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetailsInternal)Property).StorageAccountId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags _tag; + + /// Specifies the tags that will be assigned to the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParametersTags()); set => this._tag = value; } + + /// Creates an new instance. + public PutJobParameters() + { + + } + } + /// Put Job parameters + public partial interface IPutJobParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(bool) })] + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether a request has been submitted to cancel the job.", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(bool) })] + bool? CancelRequested { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.", + SerializedName = @"diagnosticsPath", + PossibleTypes = new [] { typeof(string) })] + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ", + SerializedName = @"blobListblobPath", + PossibleTypes = new [] { typeof(string) })] + string ExportBlobListblobPath { get; set; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.", + SerializedName = @"incompleteBlobListUri", + PossibleTypes = new [] { typeof(string) })] + string IncompleteBlobListUri { get; set; } + /// The type of job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of job", + SerializedName = @"jobType", + PossibleTypes = new [] { typeof(string) })] + string JobType { get; set; } + /// Specifies the supported Azure location where the job should be created + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the supported Azure location where the job should be created", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is Error. Indicates whether error logging or verbose logging will be enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + string LogLevel { get; set; } + /// Overall percentage completed for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Overall percentage completed for the job.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + int? PercentComplete { get; set; } + /// Specifies the provisioning state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the provisioning state of the job.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + string ProvisioningState { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress2 { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnPackageTrackingNumber { get; set; } + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierName { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Current state of the job.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource identifier of the storage account where data will be imported to or exported from.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + string StorageAccountId { get; set; } + /// Specifies the tags that will be assigned to the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that will be assigned to the job.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags Tag { get; set; } + + } + /// Put Job parameters + internal partial interface IPutJobParametersInternal + + { + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + bool? BackupDriveManifest { get; set; } + /// A collection of blob-path strings. + string[] BlobListBlobPath { get; set; } + /// A collection of blob-prefix strings. + string[] BlobListBlobPathPrefix { get; set; } + /// Indicates whether a request has been submitted to cancel the job. + bool? CancelRequested { get; set; } + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + string DeliveryPackageTrackingNumber { get; set; } + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + string DiagnosticsPath { get; set; } + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// + /// A property containing information about the blobs to be exported for an export job. This property is included for export + /// jobs only. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExport Export { get; set; } + /// A list of the blobs to be exported. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IExportBlobList ExportBlobList { get; set; } + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + string ExportBlobListblobPath { get; set; } + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + string IncompleteBlobListUri { get; set; } + /// The type of job + string JobType { get; set; } + /// Specifies the supported Azure location where the job should be created + string Location { get; set; } + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + string LogLevel { get; set; } + /// Overall percentage completed for the job. + int? PercentComplete { get; set; } + /// Specifies the job properties + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobDetails Property { get; set; } + /// Specifies the provisioning state of the job. + string ProvisioningState { get; set; } + /// Specifies the return address information for the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get; set; } + /// The city name to use when returning the drives. + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ReturnAddressStreetAddress2 { get; set; } + /// + /// Contains information about the package being shipped from the Microsoft data center to the customer to return the drives. + /// The format is the same as the deliveryPackage property above. This property is not included if the drives have not yet + /// been returned. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation ReturnPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string ReturnPackageCarrierName { get; set; } + /// The number of drives included in the package. + int ReturnPackageDriveCount { get; set; } + /// The date when the package is shipped. + string ReturnPackageShipDate { get; set; } + /// The tracking number of the package. + string ReturnPackageTrackingNumber { get; set; } + /// Specifies the return carrier and customer's account with the carrier. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get; set; } + /// The customer's account number with the carrier. + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + string ReturnShippingCarrierName { get; set; } + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation ShippingInformation { get; set; } + /// The city name to use when returning the drives. + string ShippingInformationCity { get; set; } + /// The country or region to use when returning the drives. + string ShippingInformationCountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + string ShippingInformationPhone { get; set; } + /// The postal code to use when returning the drives. + string ShippingInformationPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ShippingInformationRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ShippingInformationStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ShippingInformationStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ShippingInformationStreetAddress2 { get; set; } + /// Current state of the job. + string State { get; set; } + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + string StorageAccountId { get; set; } + /// Specifies the tags that will be assigned to the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.json.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.json.cs new file mode 100644 index 000000000000..9ecf78486df5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParameters.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Put Job parameters + public partial class PutJobParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new PutJobParameters(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal PutJobParameters(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.JobDetails.FromJson(__jsonProperties) : Property;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParametersTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.PowerShell.cs new file mode 100644 index 000000000000..b3d086491c8c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.PowerShell.cs @@ -0,0 +1,129 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the tags that will be assigned to the job. + [System.ComponentModel.TypeConverter(typeof(PutJobParametersTagsTypeConverter))] + public partial class PutJobParametersTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new PutJobParametersTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new PutJobParametersTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal PutJobParametersTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal PutJobParametersTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the tags that will be assigned to the job. + [System.ComponentModel.TypeConverter(typeof(PutJobParametersTagsTypeConverter))] + public partial interface IPutJobParametersTags + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.TypeConverter.cs new file mode 100644 index 000000000000..f9b1d76fd2b5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class PutJobParametersTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return PutJobParametersTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return PutJobParametersTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return PutJobParametersTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.cs new file mode 100644 index 000000000000..5ea4c67a6853 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that will be assigned to the job. + public partial class PutJobParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTagsInternal + { + + /// Creates an new instance. + public PutJobParametersTags() + { + + } + } + /// Specifies the tags that will be assigned to the job. + public partial interface IPutJobParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + + } + /// Specifies the tags that will be assigned to the job. + internal partial interface IPutJobParametersTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.json.cs b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.json.cs new file mode 100644 index 000000000000..4dc75355eb5f --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/PutJobParametersTags.json.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that will be assigned to the job. + public partial class PutJobParametersTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new PutJobParametersTags(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal PutJobParametersTags(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.PowerShell.cs new file mode 100644 index 000000000000..77df957e4664 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.PowerShell.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the return address information for the job. + [System.ComponentModel.TypeConverter(typeof(ReturnAddressTypeConverter))] + public partial class ReturnAddress + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReturnAddress(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReturnAddress(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReturnAddress(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Email = (string) content.GetValueForProperty("Email",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Email, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress2, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReturnAddress(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Email = (string) content.GetValueForProperty("Email",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Email, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)this).StreetAddress2, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the return address information for the job. + [System.ComponentModel.TypeConverter(typeof(ReturnAddressTypeConverter))] + public partial interface IReturnAddress + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.TypeConverter.cs new file mode 100644 index 000000000000..c1d303ac47eb --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReturnAddressTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReturnAddress.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReturnAddress.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReturnAddress.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.cs new file mode 100644 index 000000000000..e53031bf864c --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.cs @@ -0,0 +1,188 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the return address information for the job. + public partial class ReturnAddress : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal + { + + /// Backing field for property. + private string _city; + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string City { get => this._city; set => this._city = value; } + + /// Backing field for property. + private string _countryOrRegion; + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CountryOrRegion { get => this._countryOrRegion; set => this._countryOrRegion = value; } + + /// Backing field for property. + private string _email; + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Email { get => this._email; set => this._email = value; } + + /// Backing field for property. + private string _phone; + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private string _postalCode; + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string PostalCode { get => this._postalCode; set => this._postalCode = value; } + + /// Backing field for property. + private string _recipientName; + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string RecipientName { get => this._recipientName; set => this._recipientName = value; } + + /// Backing field for property. + private string _stateOrProvince; + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StateOrProvince { get => this._stateOrProvince; set => this._stateOrProvince = value; } + + /// Backing field for property. + private string _streetAddress1; + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress1 { get => this._streetAddress1; set => this._streetAddress1 = value; } + + /// Backing field for property. + private string _streetAddress2; + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress2 { get => this._streetAddress2; set => this._streetAddress2 = value; } + + /// Creates an new instance. + public ReturnAddress() + { + + } + } + /// Specifies the return address information for the job. + public partial interface IReturnAddress : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string CountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string Email { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string RecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + + } + /// Specifies the return address information for the job. + internal partial interface IReturnAddressInternal + + { + /// The city name to use when returning the drives. + string City { get; set; } + /// The country or region to use when returning the drives. + string CountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string Email { get; set; } + /// Phone number of the recipient of the returned drives. + string Phone { get; set; } + /// The postal code to use when returning the drives. + string PostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string RecipientName { get; set; } + /// The state or province to use when returning the drives. + string StateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string StreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string StreetAddress2 { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.json.cs new file mode 100644 index 000000000000..880e92c4c891 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnAddress.json.cs @@ -0,0 +1,117 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the return address information for the job. + public partial class ReturnAddress + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ReturnAddress(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ReturnAddress(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)City;} + {_countryOrRegion = If( json?.PropertyT("countryOrRegion"), out var __jsonCountryOrRegion) ? (string)__jsonCountryOrRegion : (string)CountryOrRegion;} + {_email = If( json?.PropertyT("email"), out var __jsonEmail) ? (string)__jsonEmail : (string)Email;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)Phone;} + {_postalCode = If( json?.PropertyT("postalCode"), out var __jsonPostalCode) ? (string)__jsonPostalCode : (string)PostalCode;} + {_recipientName = If( json?.PropertyT("recipientName"), out var __jsonRecipientName) ? (string)__jsonRecipientName : (string)RecipientName;} + {_stateOrProvince = If( json?.PropertyT("stateOrProvince"), out var __jsonStateOrProvince) ? (string)__jsonStateOrProvince : (string)StateOrProvince;} + {_streetAddress1 = If( json?.PropertyT("streetAddress1"), out var __jsonStreetAddress1) ? (string)__jsonStreetAddress1 : (string)StreetAddress1;} + {_streetAddress2 = If( json?.PropertyT("streetAddress2"), out var __jsonStreetAddress2) ? (string)__jsonStreetAddress2 : (string)StreetAddress2;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + AddIf( null != (((object)this._countryOrRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._countryOrRegion.ToString()) : null, "countryOrRegion" ,container.Add ); + AddIf( null != (((object)this._email)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._email.ToString()) : null, "email" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AddIf( null != (((object)this._postalCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._postalCode.ToString()) : null, "postalCode" ,container.Add ); + AddIf( null != (((object)this._recipientName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._recipientName.ToString()) : null, "recipientName" ,container.Add ); + AddIf( null != (((object)this._stateOrProvince)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._stateOrProvince.ToString()) : null, "stateOrProvince" ,container.Add ); + AddIf( null != (((object)this._streetAddress1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress1.ToString()) : null, "streetAddress1" ,container.Add ); + AddIf( null != (((object)this._streetAddress2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress2.ToString()) : null, "streetAddress2" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.PowerShell.cs new file mode 100644 index 000000000000..213662d8464b --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the return carrier and customer's account with the carrier. + [System.ComponentModel.TypeConverter(typeof(ReturnShippingTypeConverter))] + public partial class ReturnShipping + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ReturnShipping(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ReturnShipping(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ReturnShipping(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierAccountNumber = (string) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ReturnShipping(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierAccountNumber = (string) content.GetValueForProperty("CarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierName = (string) content.GetValueForProperty("CarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)this).CarrierName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Specifies the return carrier and customer's account with the carrier. + [System.ComponentModel.TypeConverter(typeof(ReturnShippingTypeConverter))] + public partial interface IReturnShipping + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.TypeConverter.cs new file mode 100644 index 000000000000..5949cfbad565 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ReturnShippingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ReturnShipping.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ReturnShipping.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ReturnShipping.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.cs new file mode 100644 index 000000000000..518019cd4a27 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the return carrier and customer's account with the carrier. + public partial class ReturnShipping : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal + { + + /// Backing field for property. + private string _carrierAccountNumber; + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CarrierAccountNumber { get => this._carrierAccountNumber; set => this._carrierAccountNumber = value; } + + /// Backing field for property. + private string _carrierName; + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CarrierName { get => this._carrierName; set => this._carrierName = value; } + + /// Creates an new instance. + public ReturnShipping() + { + + } + } + /// Specifies the return carrier and customer's account with the carrier. + public partial interface IReturnShipping : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string CarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string CarrierName { get; set; } + + } + /// Specifies the return carrier and customer's account with the carrier. + internal partial interface IReturnShippingInternal + + { + /// The customer's account number with the carrier. + string CarrierAccountNumber { get; set; } + /// The carrier's name. + string CarrierName { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.json.cs new file mode 100644 index 000000000000..6e998565a46b --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ReturnShipping.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the return carrier and customer's account with the carrier. + public partial class ReturnShipping + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ReturnShipping(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ReturnShipping(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_carrierAccountNumber = If( json?.PropertyT("carrierAccountNumber"), out var __jsonCarrierAccountNumber) ? (string)__jsonCarrierAccountNumber : (string)CarrierAccountNumber;} + {_carrierName = If( json?.PropertyT("carrierName"), out var __jsonCarrierName) ? (string)__jsonCarrierName : (string)CarrierName;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._carrierAccountNumber)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._carrierAccountNumber.ToString()) : null, "carrierAccountNumber" ,container.Add ); + AddIf( null != (((object)this._carrierName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._carrierName.ToString()) : null, "carrierName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.PowerShell.cs new file mode 100644 index 000000000000..424babeb73d5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.PowerShell.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + [System.ComponentModel.TypeConverter(typeof(ShippingInformationTypeConverter))] + public partial class ShippingInformation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ShippingInformation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ShippingInformation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ShippingInformation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress2, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ShippingInformation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).City = (string) content.GetValueForProperty("City",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).City, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).CountryOrRegion = (string) content.GetValueForProperty("CountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).CountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).Phone = (string) content.GetValueForProperty("Phone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).Phone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).PostalCode = (string) content.GetValueForProperty("PostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).PostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).RecipientName = (string) content.GetValueForProperty("RecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).RecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StateOrProvince = (string) content.GetValueForProperty("StateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress1 = (string) content.GetValueForProperty("StreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress2 = (string) content.GetValueForProperty("StreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal)this).StreetAddress2, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + [System.ComponentModel.TypeConverter(typeof(ShippingInformationTypeConverter))] + public partial interface IShippingInformation + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.TypeConverter.cs new file mode 100644 index 000000000000..b3037c8b490a --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ShippingInformationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ShippingInformation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ShippingInformation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ShippingInformation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.cs b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.cs new file mode 100644 index 000000000000..d3c566da6cec --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.cs @@ -0,0 +1,173 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + public partial class ShippingInformation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformationInternal + { + + /// Backing field for property. + private string _city; + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string City { get => this._city; set => this._city = value; } + + /// Backing field for property. + private string _countryOrRegion; + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string CountryOrRegion { get => this._countryOrRegion; set => this._countryOrRegion = value; } + + /// Backing field for property. + private string _phone; + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Phone { get => this._phone; set => this._phone = value; } + + /// Backing field for property. + private string _postalCode; + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string PostalCode { get => this._postalCode; set => this._postalCode = value; } + + /// Backing field for property. + private string _recipientName; + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string RecipientName { get => this._recipientName; set => this._recipientName = value; } + + /// Backing field for property. + private string _stateOrProvince; + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StateOrProvince { get => this._stateOrProvince; set => this._stateOrProvince = value; } + + /// Backing field for property. + private string _streetAddress1; + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress1 { get => this._streetAddress1; set => this._streetAddress1 = value; } + + /// Backing field for property. + private string _streetAddress2; + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string StreetAddress2 { get => this._streetAddress2; set => this._streetAddress2 = value; } + + /// Creates an new instance. + public ShippingInformation() + { + + } + } + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + public partial interface IShippingInformation : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string City { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string CountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string Phone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string PostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string RecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string StateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string StreetAddress2 { get; set; } + + } + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + internal partial interface IShippingInformationInternal + + { + /// The city name to use when returning the drives. + string City { get; set; } + /// The country or region to use when returning the drives. + string CountryOrRegion { get; set; } + /// Phone number of the recipient of the returned drives. + string Phone { get; set; } + /// The postal code to use when returning the drives. + string PostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string RecipientName { get; set; } + /// The state or province to use when returning the drives. + string StateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string StreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string StreetAddress2 { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.json.cs b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.json.cs new file mode 100644 index 000000000000..c031038a6861 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/ShippingInformation.json.cs @@ -0,0 +1,117 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Contains information about the Microsoft datacenter to which the drives should be shipped. + /// + public partial class ShippingInformation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IShippingInformation FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ShippingInformation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ShippingInformation(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_city = If( json?.PropertyT("city"), out var __jsonCity) ? (string)__jsonCity : (string)City;} + {_countryOrRegion = If( json?.PropertyT("countryOrRegion"), out var __jsonCountryOrRegion) ? (string)__jsonCountryOrRegion : (string)CountryOrRegion;} + {_phone = If( json?.PropertyT("phone"), out var __jsonPhone) ? (string)__jsonPhone : (string)Phone;} + {_postalCode = If( json?.PropertyT("postalCode"), out var __jsonPostalCode) ? (string)__jsonPostalCode : (string)PostalCode;} + {_recipientName = If( json?.PropertyT("recipientName"), out var __jsonRecipientName) ? (string)__jsonRecipientName : (string)RecipientName;} + {_stateOrProvince = If( json?.PropertyT("stateOrProvince"), out var __jsonStateOrProvince) ? (string)__jsonStateOrProvince : (string)StateOrProvince;} + {_streetAddress1 = If( json?.PropertyT("streetAddress1"), out var __jsonStreetAddress1) ? (string)__jsonStreetAddress1 : (string)StreetAddress1;} + {_streetAddress2 = If( json?.PropertyT("streetAddress2"), out var __jsonStreetAddress2) ? (string)__jsonStreetAddress2 : (string)StreetAddress2;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._city)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._city.ToString()) : null, "city" ,container.Add ); + AddIf( null != (((object)this._countryOrRegion)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._countryOrRegion.ToString()) : null, "countryOrRegion" ,container.Add ); + AddIf( null != (((object)this._phone)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._phone.ToString()) : null, "phone" ,container.Add ); + AddIf( null != (((object)this._postalCode)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._postalCode.ToString()) : null, "postalCode" ,container.Add ); + AddIf( null != (((object)this._recipientName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._recipientName.ToString()) : null, "recipientName" ,container.Add ); + AddIf( null != (((object)this._stateOrProvince)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._stateOrProvince.ToString()) : null, "stateOrProvince" ,container.Add ); + AddIf( null != (((object)this._streetAddress1)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress1.ToString()) : null, "streetAddress1" ,container.Add ); + AddIf( null != (((object)this._streetAddress2)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._streetAddress2.ToString()) : null, "streetAddress2" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.PowerShell.cs new file mode 100644 index 000000000000..fabee5292137 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.PowerShell.cs @@ -0,0 +1,179 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Update Job parameters + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersTypeConverter))] + public partial class UpdateJobParameters + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateJobParameters(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateJobParameters(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateJobParameters(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateJobParameters(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Update Job parameters + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersTypeConverter))] + public partial interface IUpdateJobParameters + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.TypeConverter.cs new file mode 100644 index 000000000000..ac73bf65e4f7 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateJobParametersTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateJobParameters.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateJobParameters.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateJobParameters.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.cs new file mode 100644 index 000000000000..2a0d4bd6183d --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.cs @@ -0,0 +1,385 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Update Job parameters + public partial class UpdateJobParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal + { + + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? BackupDriveManifest { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).BackupDriveManifest; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).BackupDriveManifest = value; } + + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public bool? CancelRequested { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).CancelRequested; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).CancelRequested = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int DeliveryPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageDriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageTrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackageTrackingNumber = value; } + + /// List of drives that comprise the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DriveList; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DriveList = value; } + + /// Indicates whether error logging or verbose logging is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string LogLevel { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).LogLevel; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).LogLevel = value; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal.DeliveryPackage { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackage; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).DeliveryPackage = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersProperties()); set { {_property = value;} } } + + /// Internal Acessors for ReturnAddress + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal.ReturnAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddress = value; } + + /// Internal Acessors for ReturnShipping + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersInternal.ReturnShipping { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShipping; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShipping = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties _property; + + /// Specifies the properties of a UpdateJob. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersProperties()); set => this._property = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressCity; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressCountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressEmail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressEmail; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressPhone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressPostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressRecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnAddressStreetAddress2 = value; } + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShippingCarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShippingCarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).ReturnShippingCarrierName = value; } + + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string State { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).State; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)Property).State = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags _tag; + + /// Specifies the tags that will be assigned to the job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersTags()); set => this._tag = value; } + + /// Creates an new instance. + public UpdateJobParameters() + { + + } + } + /// Update Job parameters + public partial interface IUpdateJobParameters : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(bool) })] + bool? BackupDriveManifest { get; set; } + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be true. The service will attempt to cancel the job. ", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(bool) })] + bool? CancelRequested { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingNumber { get; set; } + /// List of drives that comprise the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of drives that comprise the job.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// Indicates whether error logging or verbose logging is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether error logging or verbose logging is enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + string LogLevel { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress2 { get; set; } + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierName { get; set; } + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + /// Specifies the tags that will be assigned to the job + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that will be assigned to the job", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags Tag { get; set; } + + } + /// Update Job parameters + internal partial interface IUpdateJobParametersInternal + + { + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + bool? BackupDriveManifest { get; set; } + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + bool? CancelRequested { get; set; } + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + string DeliveryPackageTrackingNumber { get; set; } + /// List of drives that comprise the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// Indicates whether error logging or verbose logging is enabled. + string LogLevel { get; set; } + /// Specifies the properties of a UpdateJob. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties Property { get; set; } + /// Specifies the return address information for the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get; set; } + /// The city name to use when returning the drives. + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ReturnAddressStreetAddress2 { get; set; } + /// Specifies the return carrier and customer's account with the carrier. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get; set; } + /// The customer's account number with the carrier. + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + string ReturnShippingCarrierName { get; set; } + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + string State { get; set; } + /// Specifies the tags that will be assigned to the job + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.json.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.json.cs new file mode 100644 index 000000000000..0f0df906c443 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParameters.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Update Job parameters + public partial class UpdateJobParameters + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new UpdateJobParameters(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateJobParameters(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersProperties.FromJson(__jsonProperties) : Property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParametersTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.PowerShell.cs new file mode 100644 index 000000000000..db880a85d2b1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.PowerShell.cs @@ -0,0 +1,177 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the properties of a UpdateJob. + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersPropertiesTypeConverter))] + public partial class UpdateJobParametersProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateJobParametersProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateJobParametersProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateJobParametersProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateJobParametersProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackage = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation) content.GetValueForProperty("DeliveryPackage",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackage, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomationTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddress = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress) content.GetValueForProperty("ReturnAddress",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddress, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddressTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShipping = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping) content.GetValueForProperty("ReturnShipping",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShipping, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShippingTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).BackupDriveManifest = (bool?) content.GetValueForProperty("BackupDriveManifest",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).BackupDriveManifest, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).CancelRequested = (bool?) content.GetValueForProperty("CancelRequested",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).CancelRequested, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DriveList = (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[]) content.GetValueForProperty("DriveList",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DriveList, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatusTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).LogLevel = (string) content.GetValueForProperty("LogLevel",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).LogLevel, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).State = (string) content.GetValueForProperty("State",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).State, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPhone = (string) content.GetValueForProperty("ReturnAddressPhone",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPhone, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierName = (string) content.GetValueForProperty("ReturnShippingCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress1 = (string) content.GetValueForProperty("ReturnAddressStreetAddress1",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress1, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressRecipientName = (string) content.GetValueForProperty("ReturnAddressRecipientName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressRecipientName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCity = (string) content.GetValueForProperty("ReturnAddressCity",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCity, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPostalCode = (string) content.GetValueForProperty("ReturnAddressPostalCode",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressPostalCode, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressEmail = (string) content.GetValueForProperty("ReturnAddressEmail",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressEmail, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageDriveCount = (int) content.GetValueForProperty("DeliveryPackageDriveCount",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageDriveCount, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCountryOrRegion = (string) content.GetValueForProperty("ReturnAddressCountryOrRegion",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressCountryOrRegion, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageTrackingNumber = (string) content.GetValueForProperty("DeliveryPackageTrackingNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageTrackingNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStateOrProvince = (string) content.GetValueForProperty("ReturnAddressStateOrProvince",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStateOrProvince, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageShipDate = (string) content.GetValueForProperty("DeliveryPackageShipDate",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageShipDate, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress2 = (string) content.GetValueForProperty("ReturnAddressStreetAddress2",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnAddressStreetAddress2, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierAccountNumber = (string) content.GetValueForProperty("ReturnShippingCarrierAccountNumber",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).ReturnShippingCarrierAccountNumber, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageCarrierName = (string) content.GetValueForProperty("DeliveryPackageCarrierName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal)this).DeliveryPackageCarrierName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Specifies the properties of a UpdateJob. + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersPropertiesTypeConverter))] + public partial interface IUpdateJobParametersProperties + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.TypeConverter.cs new file mode 100644 index 000000000000..4cbafbf5188b --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateJobParametersPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateJobParametersProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateJobParametersProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateJobParametersProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.cs new file mode 100644 index 000000000000..b35a6a5949e2 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.cs @@ -0,0 +1,394 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the properties of a UpdateJob. + public partial class UpdateJobParametersProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal + { + + /// Backing field for property. + private bool? _backupDriveManifest; + + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public bool? BackupDriveManifest { get => this._backupDriveManifest; set => this._backupDriveManifest = value; } + + /// Backing field for property. + private bool? _cancelRequested; + + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public bool? CancelRequested { get => this._cancelRequested; set => this._cancelRequested = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation _deliveryPackage; + + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set => this._deliveryPackage = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).CarrierName = value; } + + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public int DeliveryPackageDriveCount { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).DriveCount; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).DriveCount = value; } + + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageShipDate { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).ShipDate; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).ShipDate = value; } + + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string DeliveryPackageTrackingNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).TrackingNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomationInternal)DeliveryPackage).TrackingNumber = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] _driveList; + + /// List of drives that comprise the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => this._driveList; set => this._driveList = value; } + + /// Backing field for property. + private string _logLevel; + + /// Indicates whether error logging or verbose logging is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string LogLevel { get => this._logLevel; set => this._logLevel = value; } + + /// Internal Acessors for DeliveryPackage + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal.DeliveryPackage { get => (this._deliveryPackage = this._deliveryPackage ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation()); set { {_deliveryPackage = value;} } } + + /// Internal Acessors for ReturnAddress + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal.ReturnAddress { get => (this._returnAddress = this._returnAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress()); set { {_returnAddress = value;} } } + + /// Internal Acessors for ReturnShipping + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersPropertiesInternal.ReturnShipping { get => (this._returnShipping = this._returnShipping ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping()); set { {_returnShipping = value;} } } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress _returnAddress; + + /// Specifies the return address information for the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get => (this._returnAddress = this._returnAddress ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress()); set => this._returnAddress = value; } + + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCity { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).City; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).City = value; } + + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressCountryOrRegion { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).CountryOrRegion; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).CountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressEmail { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Email; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Email = value; } + + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPhone { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Phone; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).Phone = value; } + + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressPostalCode { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).PostalCode; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).PostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressRecipientName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).RecipientName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).RecipientName = value; } + + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStateOrProvince { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StateOrProvince; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress1 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress1; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnAddressStreetAddress2 { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress2; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddressInternal)ReturnAddress).StreetAddress2 = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping _returnShipping; + + /// Specifies the return carrier and customer's account with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get => (this._returnShipping = this._returnShipping ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping()); set => this._returnShipping = value; } + + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierAccountNumber { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierAccountNumber; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierAccountNumber = value; } + + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Inlined)] + public string ReturnShippingCarrierName { get => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierName; set => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShippingInternal)ReturnShipping).CarrierName = value; } + + /// Backing field for property. + private string _state; + + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string State { get => this._state; set => this._state = value; } + + /// Creates an new instance. + public UpdateJobParametersProperties() + { + + } + } + /// Specifies the properties of a UpdateJob. + public partial interface IUpdateJobParametersProperties : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(bool) })] + bool? BackupDriveManifest { get; set; } + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be true. The service will attempt to cancel the job. ", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(bool) })] + bool? CancelRequested { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + string DeliveryPackageTrackingNumber { get; set; } + /// List of drives that comprise the job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of drives that comprise the job.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// Indicates whether error logging or verbose logging is enabled. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether error logging or verbose logging is enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + string LogLevel { get; set; } + /// The city name to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + string ReturnAddressStreetAddress2 { get; set; } + /// The customer's account number with the carrier. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + string ReturnShippingCarrierName { get; set; } + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + string State { get; set; } + + } + /// Specifies the properties of a UpdateJob. + internal partial interface IUpdateJobParametersPropertiesInternal + + { + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + bool? BackupDriveManifest { get; set; } + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + bool? CancelRequested { get; set; } + /// + /// Contains information about the package being shipped by the customer to the Microsoft data center. + /// + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPackageInfomation DeliveryPackage { get; set; } + /// The name of the carrier that is used to ship the import or export drives. + string DeliveryPackageCarrierName { get; set; } + /// The number of drives included in the package. + int DeliveryPackageDriveCount { get; set; } + /// The date when the package is shipped. + string DeliveryPackageShipDate { get; set; } + /// The tracking number of the package. + string DeliveryPackageTrackingNumber { get; set; } + /// List of drives that comprise the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get; set; } + /// Indicates whether error logging or verbose logging is enabled. + string LogLevel { get; set; } + /// Specifies the return address information for the job. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnAddress ReturnAddress { get; set; } + /// The city name to use when returning the drives. + string ReturnAddressCity { get; set; } + /// The country or region to use when returning the drives. + string ReturnAddressCountryOrRegion { get; set; } + /// Email address of the recipient of the returned drives. + string ReturnAddressEmail { get; set; } + /// Phone number of the recipient of the returned drives. + string ReturnAddressPhone { get; set; } + /// The postal code to use when returning the drives. + string ReturnAddressPostalCode { get; set; } + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + string ReturnAddressRecipientName { get; set; } + /// The state or province to use when returning the drives. + string ReturnAddressStateOrProvince { get; set; } + /// The first line of the street address to use when returning the drives. + string ReturnAddressStreetAddress1 { get; set; } + /// The second line of the street address to use when returning the drives. + string ReturnAddressStreetAddress2 { get; set; } + /// Specifies the return carrier and customer's account with the carrier. + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IReturnShipping ReturnShipping { get; set; } + /// The customer's account number with the carrier. + string ReturnShippingCarrierAccountNumber { get; set; } + /// The carrier's name. + string ReturnShippingCarrierName { get; set; } + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + string State { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.json.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.json.cs new file mode 100644 index 000000000000..edeef9910647 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersProperties.json.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the properties of a UpdateJob. + public partial class UpdateJobParametersProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new UpdateJobParametersProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._deliveryPackage ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._deliveryPackage.ToJson(null,serializationMode) : null, "deliveryPackage" ,container.Add ); + AddIf( null != this._returnAddress ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._returnAddress.ToJson(null,serializationMode) : null, "returnAddress" ,container.Add ); + AddIf( null != this._returnShipping ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) this._returnShipping.ToJson(null,serializationMode) : null, "returnShipping" ,container.Add ); + AddIf( null != this._backupDriveManifest ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonBoolean((bool)this._backupDriveManifest) : null, "backupDriveManifest" ,container.Add ); + AddIf( null != this._cancelRequested ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonBoolean((bool)this._cancelRequested) : null, "cancelRequested" ,container.Add ); + if (null != this._driveList) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.XNodeArray(); + foreach( var __x in this._driveList ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("driveList",__w); + } + AddIf( null != (((object)this._logLevel)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._logLevel.ToString()) : null, "logLevel" ,container.Add ); + AddIf( null != (((object)this._state)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._state.ToString()) : null, "state" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateJobParametersProperties(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_deliveryPackage = If( json?.PropertyT("deliveryPackage"), out var __jsonDeliveryPackage) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PackageInfomation.FromJson(__jsonDeliveryPackage) : DeliveryPackage;} + {_returnAddress = If( json?.PropertyT("returnAddress"), out var __jsonReturnAddress) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnAddress.FromJson(__jsonReturnAddress) : ReturnAddress;} + {_returnShipping = If( json?.PropertyT("returnShipping"), out var __jsonReturnShipping) ? Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ReturnShipping.FromJson(__jsonReturnShipping) : ReturnShipping;} + {_backupDriveManifest = If( json?.PropertyT("backupDriveManifest"), out var __jsonBackupDriveManifest) ? (bool?)__jsonBackupDriveManifest : BackupDriveManifest;} + {_cancelRequested = If( json?.PropertyT("cancelRequested"), out var __jsonCancelRequested) ? (bool?)__jsonCancelRequested : CancelRequested;} + {_driveList = If( json?.PropertyT("driveList"), out var __jsonDriveList) ? If( __jsonDriveList as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.DriveStatus.FromJson(__u) )) ))() : null : DriveList;} + {_logLevel = If( json?.PropertyT("logLevel"), out var __jsonLogLevel) ? (string)__jsonLogLevel : (string)LogLevel;} + {_state = If( json?.PropertyT("state"), out var __jsonState) ? (string)__jsonState : (string)State;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.PowerShell.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.PowerShell.cs new file mode 100644 index 000000000000..93847c2ffac5 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.PowerShell.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// Specifies the tags that will be assigned to the job + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersTagsTypeConverter))] + public partial class UpdateJobParametersTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new UpdateJobParametersTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new UpdateJobParametersTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal UpdateJobParametersTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal UpdateJobParametersTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + AfterDeserializePSObject(content); + } + } + /// Specifies the tags that will be assigned to the job + [System.ComponentModel.TypeConverter(typeof(UpdateJobParametersTagsTypeConverter))] + public partial interface IUpdateJobParametersTags + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.TypeConverter.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.TypeConverter.cs new file mode 100644 index 000000000000..f6d3e45c02e0 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class UpdateJobParametersTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return UpdateJobParametersTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return UpdateJobParametersTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return UpdateJobParametersTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.cs new file mode 100644 index 000000000000..691e010aefd1 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.cs @@ -0,0 +1,29 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that will be assigned to the job + public partial class UpdateJobParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTagsInternal + { + + /// Creates an new instance. + public UpdateJobParametersTags() + { + + } + } + /// Specifies the tags that will be assigned to the job + public partial interface IUpdateJobParametersTags : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + + } + /// Specifies the tags that will be assigned to the job + internal partial interface IUpdateJobParametersTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.json.cs b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.json.cs new file mode 100644 index 000000000000..a461693bd065 --- /dev/null +++ b/src/ImportExport/generated/api/Models/Api20161101/UpdateJobParametersTags.json.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101 +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Specifies the tags that will be assigned to the job + public partial class UpdateJobParametersTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new UpdateJobParametersTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal UpdateJobParametersTags(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/ImportExportIdentity.PowerShell.cs b/src/ImportExport/generated/api/Models/ImportExportIdentity.PowerShell.cs new file mode 100644 index 000000000000..1c319b732c25 --- /dev/null +++ b/src/ImportExport/generated/api/Models/ImportExportIdentity.PowerShell.cs @@ -0,0 +1,142 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(ImportExportIdentityTypeConverter))] + public partial class ImportExportIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ImportExportIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ImportExportIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ImportExportIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).JobName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).LocationName = (string) content.GetValueForProperty("LocationName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).LocationName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ImportExportIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).JobName = (string) content.GetValueForProperty("JobName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).JobName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).LocationName = (string) content.GetValueForProperty("LocationName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).LocationName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(ImportExportIdentityTypeConverter))] + public partial interface IImportExportIdentity + + { + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/ImportExportIdentity.TypeConverter.cs b/src/ImportExport/generated/api/Models/ImportExportIdentity.TypeConverter.cs new file mode 100644 index 000000000000..84110141151f --- /dev/null +++ b/src/ImportExport/generated/api/Models/ImportExportIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ImportExportIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new ImportExportIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ImportExportIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ImportExportIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ImportExportIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/ImportExportIdentity.cs b/src/ImportExport/generated/api/Models/ImportExportIdentity.cs new file mode 100644 index 000000000000..29f164b87ada --- /dev/null +++ b/src/ImportExport/generated/api/Models/ImportExportIdentity.cs @@ -0,0 +1,122 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public partial class ImportExportIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentityInternal + { + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _jobName; + + /// The name of the import/export job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// Backing field for property. + private string _locationName; + + /// The name of the location. For example, West US or westus. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string LocationName { get => this._locationName; set => this._locationName = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription ID for the Azure user. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Origin(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public ImportExportIdentity() + { + + } + } + public partial interface IImportExportIdentity : + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable + { + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// The name of the import/export job. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + string JobName { get; set; } + /// The name of the location. For example, West US or westus. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the location. For example, West US or westus.", + SerializedName = @"locationName", + PossibleTypes = new [] { typeof(string) })] + string LocationName { get; set; } + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// The subscription ID for the Azure user. + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + internal partial interface IImportExportIdentityInternal + + { + /// Resource identity path + string Id { get; set; } + /// The name of the import/export job. + string JobName { get; set; } + /// The name of the location. For example, West US or westus. + string LocationName { get; set; } + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + string ResourceGroupName { get; set; } + /// The subscription ID for the Azure user. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Models/ImportExportIdentity.json.cs b/src/ImportExport/generated/api/Models/ImportExportIdentity.json.cs new file mode 100644 index 000000000000..b9690024865e --- /dev/null +++ b/src/ImportExport/generated/api/Models/ImportExportIdentity.json.cs @@ -0,0 +1,113 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public partial class ImportExportIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new ImportExportIdentity(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject instance to deserialize from. + internal ImportExportIdentity(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_jobName = If( json?.PropertyT("jobName"), out var __jsonJobName) ? (string)__jsonJobName : (string)JobName;} + {_locationName = If( json?.PropertyT("locationName"), out var __jsonLocationName) ? (string)__jsonLocationName : (string)LocationName;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._jobName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._jobName.ToString()) : null, "jobName" ,container.Add ); + AddIf( null != (((object)this._locationName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._locationName.ToString()) : null, "locationName" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Support/DriveState.Completer.cs b/src/ImportExport/generated/api/Support/DriveState.Completer.cs new file mode 100644 index 000000000000..afcb7a42fa9c --- /dev/null +++ b/src/ImportExport/generated/api/Support/DriveState.Completer.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support +{ + + /// Argument completer implementation for DriveState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveStateTypeConverter))] + public partial struct DriveState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Specified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Specified", "Specified", global::System.Management.Automation.CompletionResultType.ParameterValue, "Specified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Received".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Received", "Received", global::System.Management.Automation.CompletionResultType.ParameterValue, "Received"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NeverReceived".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NeverReceived", "NeverReceived", global::System.Management.Automation.CompletionResultType.ParameterValue, "NeverReceived"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Transferring".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Transferring", "Transferring", global::System.Management.Automation.CompletionResultType.ParameterValue, "Transferring"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Completed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Completed", "Completed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Completed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "CompletedMoreInfo".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("CompletedMoreInfo", "CompletedMoreInfo", global::System.Management.Automation.CompletionResultType.ParameterValue, "CompletedMoreInfo"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "ShippedBack".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("ShippedBack", "ShippedBack", global::System.Management.Automation.CompletionResultType.ParameterValue, "ShippedBack"); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Support/DriveState.TypeConverter.cs b/src/ImportExport/generated/api/Support/DriveState.TypeConverter.cs new file mode 100644 index 000000000000..68310c7d07f4 --- /dev/null +++ b/src/ImportExport/generated/api/Support/DriveState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support +{ + + /// TypeConverter implementation for DriveState. + public partial class DriveStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => DriveState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/api/Support/DriveState.cs b/src/ImportExport/generated/api/Support/DriveState.cs new file mode 100644 index 000000000000..ccf2d26524f3 --- /dev/null +++ b/src/ImportExport/generated/api/Support/DriveState.cs @@ -0,0 +1,107 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support +{ + + public partial struct DriveState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState Completed = @"Completed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState CompletedMoreInfo = @"CompletedMoreInfo"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState NeverReceived = @"NeverReceived"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState Received = @"Received"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState ShippedBack = @"ShippedBack"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState Specified = @"Specified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState Transferring = @"Transferring"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to DriveState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new DriveState(System.Convert.ToString(value)); + } + + /// Creates an instance of the + /// the value to create an instance for. + private DriveState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Compares values of enum type DriveState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type DriveState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is DriveState && Equals((DriveState)obj); + } + + /// Returns hashCode for enum DriveState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for DriveState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to DriveState + /// the value to convert to an instance of . + + public static implicit operator DriveState(string value) + { + return new DriveState(value); + } + + /// Implicit operator to convert DriveState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e) + { + return e._value; + } + + /// Overriding != operator for enum DriveState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e1, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum DriveState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e1, Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExportBitLockerKey_List.cs b/src/ImportExport/generated/cmdlets/GetAzImportExportBitLockerKey_List.cs new file mode 100644 index 000000000000..0ae42862dc72 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExportBitLockerKey_List.cs @@ -0,0 +1,419 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Returns the BitLocker Keys for all drives in the specified job. + /// + /// [OpenAPI] BitLockerKeys_List=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}/listBitLockerKeys" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExportBitLockerKey_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns the BitLocker Keys for all drives in the specified job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExportBitLockerKey_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _jobName; + + /// The name of the import/export job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string JobName { get => this._jobName; set => this._jobName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExportBitLockerKey_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BitLockerKeysList' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BitLockerKeysList(JobName, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { JobName=JobName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { JobName=JobName, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { JobName=JobName, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_Get.cs b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_Get.cs new file mode 100644 index 000000000000..d031ff07abbd --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_Get.cs @@ -0,0 +1,381 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Returns the details about a location to which you can ship the disks associated with an import or export job. A location + /// is an Azure region. + /// + /// + /// [OpenAPI] Locations_Get=>GET:"/providers/Microsoft.ImportExport/locations/{locationName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExportLocation_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExportLocation_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the location. For example, West US or westus. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the location. For example, West US or westus.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the location. For example, West US or westus.", + SerializedName = @"locationName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("LocationName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExportLocation_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsGet(Name, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_GetViaIdentity.cs b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_GetViaIdentity.cs new file mode 100644 index 000000000000..e60656b1e9fa --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_GetViaIdentity.cs @@ -0,0 +1,386 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Returns the details about a location to which you can ship the disks associated with an import or export job. A location + /// is an Azure region. + /// + /// + /// [OpenAPI] Locations_Get=>GET:"/providers/Microsoft.ImportExport/locations/{locationName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExportLocation_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns the details about a location to which you can ship the disks associated with an import or export job. A location is an Azure region.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExportLocation_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExportLocation_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.LocationsGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.LocationName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.LocationName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.LocationsGet(InputObject.LocationName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_List.cs b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_List.cs new file mode 100644 index 000000000000..ebb6febeb3ba --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExportLocation_List.cs @@ -0,0 +1,367 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft + /// data center region. + /// + /// + /// [OpenAPI] Locations_List=>GET:"/providers/Microsoft.ImportExport/locations" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExportLocation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns a list of locations to which you can ship the disks associated with an import or export job. A location is a Microsoft data center region.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExportLocation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExportLocation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsList(this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExport_Get.cs b/src/ImportExport/generated/cmdlets/GetAzImportExport_Get.cs new file mode 100644 index 000000000000..85a89fdcf4f9 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExport_Get.cs @@ -0,0 +1,415 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Gets information about an existing job. + /// + /// [OpenAPI] Jobs_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExport_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Gets information about an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExport_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the import/export job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExport_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsGet(Name, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExport_GetViaIdentity.cs b/src/ImportExport/generated/cmdlets/GetAzImportExport_GetViaIdentity.cs new file mode 100644 index 000000000000..924ac4c19847 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExport_GetViaIdentity.cs @@ -0,0 +1,391 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Gets information about an existing job. + /// + /// [OpenAPI] Jobs_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExport_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Gets information about an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExport_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExport_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsGetViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsGet(InputObject.JobName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExport_List.cs b/src/ImportExport/generated/cmdlets/GetAzImportExport_List.cs new file mode 100644 index 000000000000..73d87454c2a8 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExport_List.cs @@ -0,0 +1,425 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Returns all active and completed jobs in a subscription. + /// + /// [OpenAPI] Jobs_ListBySubscription=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.ImportExport/jobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExport_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns all active and completed jobs in a subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExport_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// Can be used to restrict the results to certain conditions. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Can be used to restrict the results to certain conditions.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Can be used to restrict the results to certain conditions.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private int _top; + + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.", + SerializedName = @"$top", + PossibleTypes = new [] { typeof(int) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Query)] + public int Top { get => this._top; set => this._top = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExport_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListBySubscription(this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,SubscriptionId=SubscriptionId,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId=SubscriptionId, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId=SubscriptionId, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListBySubscription_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzImportExport_List1.cs b/src/ImportExport/generated/cmdlets/GetAzImportExport_List1.cs new file mode 100644 index 000000000000..732bc9f08407 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzImportExport_List1.cs @@ -0,0 +1,441 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Returns all active and completed jobs in a resource group. + /// + /// [OpenAPI] Jobs_ListByResourceGroup=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzImportExport_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns all active and completed jobs in a resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzImportExport_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Backing field for property. + private string _filter; + + /// Can be used to restrict the results to certain conditions. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Can be used to restrict the results to certain conditions.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Can be used to restrict the results to certain conditions.", + SerializedName = @"$filter", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Query)] + public string Filter { get => this._filter; set => this._filter = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private int _top; + + /// + /// An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"An integer value that specifies how many jobs at most should be returned. The value cannot exceed 100.", + SerializedName = @"$top", + PossibleTypes = new [] { typeof(int) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Query)] + public int Top { get => this._top; set => this._top = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzImportExport_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListByResourceGroup(this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?),Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Top=this.InvocationInformation.BoundParameters.ContainsKey("Top") ? Top : default(int?), Filter=this.InvocationInformation.BoundParameters.ContainsKey("Filter") ? Filter : null, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsListByResourceGroup_Call(requestMessage, onOk, onDefault, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/GetAzOperation_List.cs b/src/ImportExport/generated/cmdlets/GetAzOperation_List.cs new file mode 100644 index 000000000000..c340476c4b18 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/GetAzOperation_List.cs @@ -0,0 +1,367 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Returns the list of operations supported by the import/export resource provider. + /// + /// + /// [OpenAPI] Operations_List=>GET:"/providers/Microsoft.ImportExport/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Returns the list of operations supported by the import/export resource provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class GetAzOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/NewAzImportExport_CreateExpanded.cs b/src/ImportExport/generated/cmdlets/NewAzImportExport_CreateExpanded.cs new file mode 100644 index 000000000000..57f917f20b3d --- /dev/null +++ b/src/ImportExport/generated/cmdlets/NewAzImportExport_CreateExpanded.cs @@ -0,0 +1,968 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// Creates a new job or updates an existing job in the specified subscription. + /// + /// [OpenAPI] Jobs_Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzImportExport_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Creates a new job or updates an existing job in the specified subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class NewAzImportExport_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// + /// Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is false. Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter BackupDriveManifest { get => Body.BackupDriveManifest ?? default(global::System.Management.Automation.SwitchParameter); set => Body.BackupDriveManifest = value; } + + /// A collection of blob-path strings. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A collection of blob-path strings.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-path strings.", + SerializedName = @"blobPath", + PossibleTypes = new [] { typeof(string) })] + public string[] BlobListBlobPath { get => Body.BlobListBlobPath ?? null /* arrayOf */; set => Body.BlobListBlobPath = value; } + + /// A collection of blob-prefix strings. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A collection of blob-prefix strings.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A collection of blob-prefix strings.", + SerializedName = @"blobPathPrefix", + PossibleTypes = new [] { typeof(string) })] + public string[] BlobListBlobPathPrefix { get => Body.BlobListBlobPathPrefix ?? null /* arrayOf */; set => Body.BlobListBlobPathPrefix = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters _body= new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.PutJobParameters(); + + /// Put Job parameters + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParameters Body { get => this._body; set => this._body = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// Indicates whether a request has been submitted to cancel the job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether a request has been submitted to cancel the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether a request has been submitted to cancel the job.", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter CancelRequested { get => Body.CancelRequested ?? default(global::System.Management.Automation.SwitchParameter); set => Body.CancelRequested = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// Backing field for property. + private string _clientTenantId; + + /// The tenant ID of the client making the request. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tenant ID of the client making the request.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tenant ID of the client making the request.", + SerializedName = @"x-ms-client-tenant-id", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string ClientTenantId { get => this._clientTenantId; set => this._clientTenantId = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the carrier that is used to ship the import or export drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the carrier that is used to ship the import or export drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageCarrierName { get => Body.DeliveryPackageCarrierName ?? null; set => Body.DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The number of drives included in the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + public int DeliveryPackageDriveCount { get => Body.DeliveryPackageDriveCount; set => Body.DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The date when the package is shipped.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageShipDate { get => Body.DeliveryPackageShipDate ?? null; set => Body.DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tracking number of the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageTrackingNumber { get => Body.DeliveryPackageTrackingNumber ?? null; set => Body.DeliveryPackageTrackingNumber = value; } + + /// + /// The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored.", + SerializedName = @"diagnosticsPath", + PossibleTypes = new [] { typeof(string) })] + public string DiagnosticsPath { get => Body.DiagnosticsPath ?? null; set => Body.DiagnosticsPath = value; } + + /// + /// List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified + /// for export jobs. + /// + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => Body.DriveList ?? null /* arrayOf */; set => Body.DriveList = value; } + + /// + /// The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning + /// with the container name. If the blob is in root container, the URI must begin with $root. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. If the blob is in root container, the URI must begin with $root. ", + SerializedName = @"blobListblobPath", + PossibleTypes = new [] { typeof(string) })] + public string ExportBlobListblobPath { get => Body.ExportBlobListblobPath ?? null; set => Body.ExportBlobListblobPath = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// + /// A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive + /// space. If all blobs were exported successfully, then this element is not included in the response. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. If all blobs were exported successfully, then this element is not included in the response.", + SerializedName = @"incompleteBlobListUri", + PossibleTypes = new [] { typeof(string) })] + public string IncompleteBlobListUri { get => Body.IncompleteBlobListUri ?? null; set => Body.IncompleteBlobListUri = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The type of job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The type of job", + SerializedName = @"jobType", + PossibleTypes = new [] { typeof(string) })] + public string JobType { get => Body.JobType ?? null; set => Body.JobType = value; } + + /// Specifies the supported Azure location where the job should be created + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the supported Azure location where the job should be created")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the supported Azure location where the job should be created", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => Body.Location ?? null; set => Body.Location = value; } + + /// + /// Default value is Error. Indicates whether error logging or verbose logging will be enabled. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Default value is Error. Indicates whether error logging or verbose logging will be enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Default value is Error. Indicates whether error logging or verbose logging will be enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + public string LogLevel { get => Body.LogLevel ?? null; set => Body.LogLevel = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the import/export job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Overall percentage completed for the job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Overall percentage completed for the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Overall percentage completed for the job.", + SerializedName = @"percentComplete", + PossibleTypes = new [] { typeof(int) })] + public int PercentComplete { get => Body.PercentComplete ?? default(int); set => Body.PercentComplete = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// Specifies the provisioning state of the job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the provisioning state of the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the provisioning state of the job.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(string) })] + public string ProvisioningState { get => Body.ProvisioningState ?? null; set => Body.ProvisioningState = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The city name to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city name to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCity { get => Body.ReturnAddressCity ?? null; set => Body.ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCountryOrRegion { get => Body.ReturnAddressCountryOrRegion ?? null; set => Body.ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Email address of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressEmail { get => Body.ReturnAddressEmail ?? null; set => Body.ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Phone number of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPhone { get => Body.ReturnAddressPhone ?? null; set => Body.ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The postal code to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPostalCode { get => Body.ReturnAddressPostalCode ?? null; set => Body.ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the recipient who will receive the hard drives when they are returned. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressRecipientName { get => Body.ReturnAddressRecipientName ?? null; set => Body.ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The state or province to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStateOrProvince { get => Body.ReturnAddressStateOrProvince ?? null; set => Body.ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The first line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress1 { get => Body.ReturnAddressStreetAddress1 ?? null; set => Body.ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The second line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress2 { get => Body.ReturnAddressStreetAddress2 ?? null; set => Body.ReturnAddressStreetAddress2 = value; } + + /// The name of the carrier that is used to ship the import or export drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the carrier that is used to ship the import or export drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnPackageCarrierName { get => Body.ReturnPackageCarrierName ?? null; set => Body.ReturnPackageCarrierName = value; } + + /// The number of drives included in the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The number of drives included in the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + public int ReturnPackageDriveCount { get => Body.ReturnPackageDriveCount; set => Body.ReturnPackageDriveCount = value; } + + /// The date when the package is shipped. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The date when the package is shipped.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + public string ReturnPackageShipDate { get => Body.ReturnPackageShipDate ?? null; set => Body.ReturnPackageShipDate = value; } + + /// The tracking number of the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tracking number of the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + public string ReturnPackageTrackingNumber { get => Body.ReturnPackageTrackingNumber ?? null; set => Body.ReturnPackageTrackingNumber = value; } + + /// The customer's account number with the carrier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer's account number with the carrier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierAccountNumber { get => Body.ReturnShippingCarrierAccountNumber ?? null; set => Body.ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The carrier's name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierName { get => Body.ReturnShippingCarrierName ?? null; set => Body.ReturnShippingCarrierName = value; } + + /// The city name to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city name to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationCity { get => Body.ShippingInformationCity ?? null; set => Body.ShippingInformationCity = value; } + + /// The country or region to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationCountryOrRegion { get => Body.ShippingInformationCountryOrRegion ?? null; set => Body.ShippingInformationCountryOrRegion = value; } + + /// Phone number of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Phone number of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationPhone { get => Body.ShippingInformationPhone ?? null; set => Body.ShippingInformationPhone = value; } + + /// The postal code to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The postal code to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationPostalCode { get => Body.ShippingInformationPostalCode ?? null; set => Body.ShippingInformationPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the recipient who will receive the hard drives when they are returned. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationRecipientName { get => Body.ShippingInformationRecipientName ?? null; set => Body.ShippingInformationRecipientName = value; } + + /// The state or province to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The state or province to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationStateOrProvince { get => Body.ShippingInformationStateOrProvince ?? null; set => Body.ShippingInformationStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The first line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationStreetAddress1 { get => Body.ShippingInformationStreetAddress1 ?? null; set => Body.ShippingInformationStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The second line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ShippingInformationStreetAddress2 { get => Body.ShippingInformationStreetAddress2 ?? null; set => Body.ShippingInformationStreetAddress2 = value; } + + /// Current state of the job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Current state of the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Current state of the job.", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + public string State { get => Body.State ?? null; set => Body.State = value; } + + /// + /// The resource identifier of the storage account where data will be imported to or exported from. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The resource identifier of the storage account where data will be imported to or exported from.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The resource identifier of the storage account where data will be imported to or exported from.", + SerializedName = @"storageAccountId", + PossibleTypes = new [] { typeof(string) })] + public string StorageAccountId { get => Body.StorageAccountId ?? null; set => Body.StorageAccountId = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Specifies the tags that will be assigned to the job. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the tags that will be assigned to the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that will be assigned to the job.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags Tag { get => Body.Tag ?? null /* object */; set => Body.Tag = value; } + + /// + /// overrideOnCreated will be called before the regular onCreated has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onCreated method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzImportExport_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsCreate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsCreate(Name, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, this.InvocationInformation.BoundParameters.ContainsKey("ClientTenantId") ? ClientTenantId : null, Body, onOk, onCreated, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null,ClientTenantId=this.InvocationInformation.BoundParameters.ContainsKey("ClientTenantId") ? ClientTenantId : null,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 201 (Created). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onCreated(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnCreated(responseMessage, response, ref _returnNow); + // if overrideOnCreated has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onCreated - response for 201 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, ClientTenantId=this.InvocationInformation.BoundParameters.ContainsKey("ClientTenantId") ? ClientTenantId : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, ClientTenantId=this.InvocationInformation.BoundParameters.ContainsKey("ClientTenantId") ? ClientTenantId : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/RemoveAzImportExport_Delete.cs b/src/ImportExport/generated/cmdlets/RemoveAzImportExport_Delete.cs new file mode 100644 index 000000000000..bfe1c080cbed --- /dev/null +++ b/src/ImportExport/generated/cmdlets/RemoveAzImportExport_Delete.cs @@ -0,0 +1,422 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + /// + /// + /// [OpenAPI] Jobs_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzImportExport_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Deletes an existing job. Only jobs in the Creating or Completed states can be deleted.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class RemoveAzImportExport_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the import/export job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsDelete(Name, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzImportExport_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/RemoveAzImportExport_DeleteViaIdentity.cs b/src/ImportExport/generated/cmdlets/RemoveAzImportExport_DeleteViaIdentity.cs new file mode 100644 index 000000000000..1795d56eec91 --- /dev/null +++ b/src/ImportExport/generated/cmdlets/RemoveAzImportExport_DeleteViaIdentity.cs @@ -0,0 +1,401 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Deletes an existing job. Only jobs in the Creating or Completed states can be deleted. + /// + /// + /// [OpenAPI] Jobs_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzImportExport_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Deletes an existing job. Only jobs in the Creating or Completed states can be deleted.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class RemoveAzImportExport_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsDelete' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsDeleteViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsDelete(InputObject.JobName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzImportExport_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateExpanded.cs b/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateExpanded.cs new file mode 100644 index 000000000000..96d48c20313e --- /dev/null +++ b/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateExpanded.cs @@ -0,0 +1,667 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives + /// comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing + /// job. + /// + /// + /// [OpenAPI] Jobs_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzImportExport_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class UpdateAzImportExport_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the manifest files on the drives should be copied to block blobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter BackupDriveManifest { get => Body.BackupDriveManifest ?? default(global::System.Management.Automation.SwitchParameter); set => Body.BackupDriveManifest = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters _body= new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParameters(); + + /// Update Job parameters + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters Body { get => this._body; set => this._body = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "If specified, the value must be true. The service will attempt to cancel the job. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be true. The service will attempt to cancel the job. ", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter CancelRequested { get => Body.CancelRequested ?? default(global::System.Management.Automation.SwitchParameter); set => Body.CancelRequested = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the carrier that is used to ship the import or export drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the carrier that is used to ship the import or export drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageCarrierName { get => Body.DeliveryPackageCarrierName ?? null; set => Body.DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The number of drives included in the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + public int DeliveryPackageDriveCount { get => Body.DeliveryPackageDriveCount; set => Body.DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The date when the package is shipped.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageShipDate { get => Body.DeliveryPackageShipDate ?? null; set => Body.DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tracking number of the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageTrackingNumber { get => Body.DeliveryPackageTrackingNumber ?? null; set => Body.DeliveryPackageTrackingNumber = value; } + + /// List of drives that comprise the job. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of drives that comprise the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of drives that comprise the job.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => Body.DriveList ?? null /* arrayOf */; set => Body.DriveList = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Indicates whether error logging or verbose logging is enabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether error logging or verbose logging is enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether error logging or verbose logging is enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + public string LogLevel { get => Body.LogLevel ?? null; set => Body.LogLevel = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// The name of the import/export job. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the import/export job.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the import/export job.", + SerializedName = @"jobName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("JobName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The resource group name uniquely identifies the resource group within the user subscription. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The resource group name uniquely identifies the resource group within the user subscription.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The resource group name uniquely identifies the resource group within the user subscription.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// The city name to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city name to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCity { get => Body.ReturnAddressCity ?? null; set => Body.ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCountryOrRegion { get => Body.ReturnAddressCountryOrRegion ?? null; set => Body.ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Email address of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressEmail { get => Body.ReturnAddressEmail ?? null; set => Body.ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Phone number of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPhone { get => Body.ReturnAddressPhone ?? null; set => Body.ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The postal code to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPostalCode { get => Body.ReturnAddressPostalCode ?? null; set => Body.ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the recipient who will receive the hard drives when they are returned. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressRecipientName { get => Body.ReturnAddressRecipientName ?? null; set => Body.ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The state or province to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStateOrProvince { get => Body.ReturnAddressStateOrProvince ?? null; set => Body.ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The first line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress1 { get => Body.ReturnAddressStreetAddress1 ?? null; set => Body.ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The second line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress2 { get => Body.ReturnAddressStreetAddress2 ?? null; set => Body.ReturnAddressStreetAddress2 = value; } + + /// The customer's account number with the carrier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer's account number with the carrier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierAccountNumber { get => Body.ReturnShippingCarrierAccountNumber ?? null; set => Body.ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The carrier's name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierName { get => Body.ReturnShippingCarrierName ?? null; set => Body.ReturnShippingCarrierName = value; } + + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + public string State { get => Body.State ?? null; set => Body.State = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// The subscription ID for the Azure user. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The subscription ID for the Azure user.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The subscription ID for the Azure user.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Specifies the tags that will be assigned to the job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the tags that will be assigned to the job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that will be assigned to the job", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags Tag { get => Body.Tag ?? null /* object */; set => Body.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.JobsUpdate(Name, SubscriptionId, ResourceGroupName, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, Body, onOk, onDefault, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzImportExport_UpdateExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name, SubscriptionId=SubscriptionId, ResourceGroupName=ResourceGroupName, AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateViaIdentityExpanded.cs b/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..1574e45c4c0a --- /dev/null +++ b/src/ImportExport/generated/cmdlets/UpdateAzImportExport_UpdateViaIdentityExpanded.cs @@ -0,0 +1,646 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + /// + /// Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives + /// comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing + /// job. + /// + /// + /// [OpenAPI] Jobs_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ImportExport/jobs/{jobName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzImportExport_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse))] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Description(@"Updates specific properties of a job. You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. It can also be used to cancel an existing job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Generated] + public partial class UpdateAzImportExport_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _acceptLanguage; + + /// Specifies the preferred language for the response. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the preferred language for the response.")] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the preferred language for the response.", + SerializedName = @"Accept-Language", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Header)] + public string AcceptLanguage { get => this._acceptLanguage; set => this._acceptLanguage = value; } + + /// + /// Indicates whether the manifest files on the drives should be copied to block blobs. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether the manifest files on the drives should be copied to block blobs.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether the manifest files on the drives should be copied to block blobs.", + SerializedName = @"backupDriveManifest", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter BackupDriveManifest { get => Body.BackupDriveManifest ?? default(global::System.Management.Automation.SwitchParameter); set => Body.BackupDriveManifest = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters _body= new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.UpdateJobParameters(); + + /// Update Job parameters + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParameters Body { get => this._body; set => this._body = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// + /// If specified, the value must be true. The service will attempt to cancel the job. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "If specified, the value must be true. The service will attempt to cancel the job. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be true. The service will attempt to cancel the job. ", + SerializedName = @"cancelRequested", + PossibleTypes = new [] { typeof(global::System.Management.Automation.SwitchParameter) })] + public global::System.Management.Automation.SwitchParameter CancelRequested { get => Body.CancelRequested ?? default(global::System.Management.Automation.SwitchParameter); set => Body.CancelRequested = value; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ImportExport Client => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// The name of the carrier that is used to ship the import or export drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the carrier that is used to ship the import or export drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the carrier that is used to ship the import or export drives.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageCarrierName { get => Body.DeliveryPackageCarrierName ?? null; set => Body.DeliveryPackageCarrierName = value; } + + /// The number of drives included in the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The number of drives included in the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The number of drives included in the package.", + SerializedName = @"driveCount", + PossibleTypes = new [] { typeof(int) })] + public int DeliveryPackageDriveCount { get => Body.DeliveryPackageDriveCount; set => Body.DeliveryPackageDriveCount = value; } + + /// The date when the package is shipped. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The date when the package is shipped.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The date when the package is shipped.", + SerializedName = @"shipDate", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageShipDate { get => Body.DeliveryPackageShipDate ?? null; set => Body.DeliveryPackageShipDate = value; } + + /// The tracking number of the package. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The tracking number of the package.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The tracking number of the package.", + SerializedName = @"trackingNumber", + PossibleTypes = new [] { typeof(string) })] + public string DeliveryPackageTrackingNumber { get => Body.DeliveryPackageTrackingNumber ?? null; set => Body.DeliveryPackageTrackingNumber = value; } + + /// List of drives that comprise the job. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "List of drives that comprise the job.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"List of drives that comprise the job.", + SerializedName = @"driveList", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] DriveList { get => Body.DriveList ?? null /* arrayOf */; set => Body.DriveList = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Indicates whether error logging or verbose logging is enabled. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Indicates whether error logging or verbose logging is enabled.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Indicates whether error logging or verbose logging is enabled.", + SerializedName = @"logLevel", + PossibleTypes = new [] { typeof(string) })] + public string LogLevel { get => Body.LogLevel ?? null; set => Body.LogLevel = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// The city name to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The city name to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The city name to use when returning the drives.", + SerializedName = @"city", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCity { get => Body.ReturnAddressCity ?? null; set => Body.ReturnAddressCity = value; } + + /// The country or region to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The country or region to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The country or region to use when returning the drives. ", + SerializedName = @"countryOrRegion", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressCountryOrRegion { get => Body.ReturnAddressCountryOrRegion ?? null; set => Body.ReturnAddressCountryOrRegion = value; } + + /// Email address of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Email address of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Email address of the recipient of the returned drives.", + SerializedName = @"email", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressEmail { get => Body.ReturnAddressEmail ?? null; set => Body.ReturnAddressEmail = value; } + + /// Phone number of the recipient of the returned drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Phone number of the recipient of the returned drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Phone number of the recipient of the returned drives.", + SerializedName = @"phone", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPhone { get => Body.ReturnAddressPhone ?? null; set => Body.ReturnAddressPhone = value; } + + /// The postal code to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The postal code to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The postal code to use when returning the drives.", + SerializedName = @"postalCode", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressPostalCode { get => Body.ReturnAddressPostalCode ?? null; set => Body.ReturnAddressPostalCode = value; } + + /// + /// The name of the recipient who will receive the hard drives when they are returned. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The name of the recipient who will receive the hard drives when they are returned. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the recipient who will receive the hard drives when they are returned. ", + SerializedName = @"recipientName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressRecipientName { get => Body.ReturnAddressRecipientName ?? null; set => Body.ReturnAddressRecipientName = value; } + + /// The state or province to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The state or province to use when returning the drives.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The state or province to use when returning the drives.", + SerializedName = @"stateOrProvince", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStateOrProvince { get => Body.ReturnAddressStateOrProvince ?? null; set => Body.ReturnAddressStateOrProvince = value; } + + /// The first line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The first line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The first line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress1", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress1 { get => Body.ReturnAddressStreetAddress1 ?? null; set => Body.ReturnAddressStreetAddress1 = value; } + + /// The second line of the street address to use when returning the drives. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The second line of the street address to use when returning the drives. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The second line of the street address to use when returning the drives. ", + SerializedName = @"streetAddress2", + PossibleTypes = new [] { typeof(string) })] + public string ReturnAddressStreetAddress2 { get => Body.ReturnAddressStreetAddress2 ?? null; set => Body.ReturnAddressStreetAddress2 = value; } + + /// The customer's account number with the carrier. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The customer's account number with the carrier.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The customer's account number with the carrier.", + SerializedName = @"carrierAccountNumber", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierAccountNumber { get => Body.ReturnShippingCarrierAccountNumber ?? null; set => Body.ReturnShippingCarrierAccountNumber = value; } + + /// The carrier's name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The carrier's name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The carrier's name.", + SerializedName = @"carrierName", + PossibleTypes = new [] { typeof(string) })] + public string ReturnShippingCarrierName { get => Body.ReturnShippingCarrierName ?? null; set => Body.ReturnShippingCarrierName = value; } + + /// + /// If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been + /// shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, + /// otherwise the request will fail. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. ", + SerializedName = @"state", + PossibleTypes = new [] { typeof(string) })] + public string State { get => Body.State ?? null; set => Body.State = value; } + + /// Specifies the tags that will be assigned to the job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Specifies the tags that will be assigned to the job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category(global::Microsoft.Azure.PowerShell.Cmdlets.ImportExport.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Specifies the tags that will be assigned to the job", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags Tag { get => Body.Tag ?? null /* object */; set => Body.Tag = value; } + + /// + /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what + /// happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onDefault method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'JobsUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.JobsUpdateViaIdentity(InputObject.Id, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, Body, onOk, onDefault, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.JobName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.JobName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.JobsUpdate(InputObject.JobName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, Body, onOk, onDefault, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null,body=Body}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzImportExport_UpdateViaIdentityExpanded() + { + + } + + /// + /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnDefault(responseMessage, response, ref _returnNow); + // if overrideOnDefault has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // Error Response : default + var code = (await response)?.Code; + var message = (await response)?.Message; + if ((null == code || null == message)) + { + // Unrecognized Response. Create an error record based on what we have. + var ex = new Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.RestException(responseMessage, await response); + WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } + }); + } + else + { + WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { AcceptLanguage=this.InvocationInformation.BoundParameters.ContainsKey("AcceptLanguage") ? AcceptLanguage : null, body=Body }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } + }); + } + } + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/AsyncCommandRuntime.cs b/src/ImportExport/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..408a34f4c64c --- /dev/null +++ b/src/ImportExport/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,828 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/AsyncJob.cs b/src/ImportExport/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..19eafa43bf8a --- /dev/null +++ b/src/ImportExport/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/AsyncOperationResponse.cs b/src/ImportExport/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..4ca5d1390f25 --- /dev/null +++ b/src/ImportExport/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..1c0469b2f3db --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..f50d5abac519 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..1712de5164d6 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support"; + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!IsAzure || pf.Property.Name != "Id") + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..0b54f0c09f14 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..832153ac7023 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..984be7eb7238 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append(@" +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +"); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } catch (Exception ee) { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..9dc06825ae88 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,125 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.ImportExport.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: ImportExport cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.ImportExport.private.dll"}'"); + + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.ImportExport.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule ImportExport".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..958d295446ca --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,137 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine(@"$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath)" +); + sb.AppendLine($@"$TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@"$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName +"); + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..c26c9eaa42b1 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..8ceefe16ca6c --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..ff3875d0a6a9 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/CollectionExtensions.cs b/src/ImportExport/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..ff4bb9a6d482 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/ImportExport/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..c1d67d6184a8 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + if (markdownInfo.SupportsPaging) + { + foreach (var parameter in SupportsPagingParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"### {alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..fc722dffa97a --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..b98807dbb690 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name} +{ExampleCodeHeader} +{ExampleInfo.Code} +{ExampleCodeFooter} + +{ExampleInfo.Description.ToDescriptionFormat()} + +"; + } + + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Description.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..5f8b34c97608 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..1e8c319e3658 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,291 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (codeEndIndex ?? 0) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + if (Variant.SupportsPaging) + { + parameterStrings = parameterStrings.Append(" [-First ]").Append(" [-IncludeTotalCount]").Append(" [-Skip ]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string description) + { + Name = name; + Code = code; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}") + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..3e73a710fdd2 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,513 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BeginOutput + { + public VariantGroup VariantGroup { get; } + + public BeginOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput + { + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + } + + internal class EndOutput + { + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new [] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new []{"
", "\r\n", "\n"}); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..6452c84a351e --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,499 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{variantGroup.ModuleName.ToLowerInvariant()}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => !ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)); + } + return parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))).ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/PsAttributes.cs b/src/ImportExport/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..9d88b24828e7 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/PsExtensions.cs b/src/ImportExport/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..bce721342dd1 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,160 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/PsHelpers.cs b/src/ImportExport/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..1e621e607847 --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/StringExtensions.cs b/src/ImportExport/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..9e701ce9879c --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/ImportExport/generated/runtime/BuildTime/XmlExtensions.cs b/src/ImportExport/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..912ce229a3ae --- /dev/null +++ b/src/ImportExport/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/ImportExport/generated/runtime/CmdInfoHandler.cs b/src/ImportExport/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..6441f47578cc --- /dev/null +++ b/src/ImportExport/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/ImportExport/generated/runtime/Conversions/ConversionException.cs b/src/ImportExport/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..19750babff03 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/IJsonConverter.cs b/src/ImportExport/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..c6e7069ab920 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..f1badbc09095 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..3829a30381f7 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..ebcaed6ab4a3 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..6f33d4ecfab3 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..0e6d4dc17331 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..9ec33f01775f --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..6728b57d160a --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..ad7f2609f470 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..748a6c34ce7d --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..9f0e498f7651 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..ddc93868a1cf --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..f93b6f4b0bd1 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..4457f7f72210 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..7ea2cfb47fe2 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..203edb831d47 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/StringConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..661e354e5c42 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..de2e693b4829 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..129ec7c0e1b7 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..31eaa3ff05f1 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..84a7242671c2 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/Instances/UriConverter.cs b/src/ImportExport/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..5d442033a9db --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/JsonConverter.cs b/src/ImportExport/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..edac1c729169 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/ImportExport/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..c008a5934fce --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/JsonConverterFactory.cs b/src/ImportExport/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..bad1dc30df8a --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Conversions/StringLikeConverter.cs b/src/ImportExport/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..e6832e464ad9 --- /dev/null +++ b/src/ImportExport/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/IJsonSerializable.cs b/src/ImportExport/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..d3b90c03b3b3 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,249 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonArray.cs b/src/ImportExport/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..97ac0efe9b61 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonBoolean.cs b/src/ImportExport/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..7c7d54aff525 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonNode.cs b/src/ImportExport/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..a2f085ad032c --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonNumber.cs b/src/ImportExport/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..924d38a2cf73 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonObject.cs b/src/ImportExport/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..6dcd06eac1bb --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/JsonString.cs b/src/ImportExport/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..bafde9a64a98 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Customizations/XNodeArray.cs b/src/ImportExport/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..1cc3dd2f4206 --- /dev/null +++ b/src/ImportExport/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Debugging.cs b/src/ImportExport/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..b7deb135aada --- /dev/null +++ b/src/ImportExport/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/ImportExport/generated/runtime/DictionaryExtensions.cs b/src/ImportExport/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..7226a1a0c08f --- /dev/null +++ b/src/ImportExport/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + if (value is System.Collections.Hashtable nested) + { + HashTableToDictionary(nested, new System.Collections.Generic.Dictionary()); + } + else + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/EventData.cs b/src/ImportExport/generated/runtime/EventData.cs new file mode 100644 index 000000000000..cafc1d736f6d --- /dev/null +++ b/src/ImportExport/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/EventDataExtensions.cs b/src/ImportExport/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..3adb0303f778 --- /dev/null +++ b/src/ImportExport/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System; + + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/EventListener.cs b/src/ImportExport/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..9fc594a2960a --- /dev/null +++ b/src/ImportExport/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Events.cs b/src/ImportExport/generated/runtime/Events.cs new file mode 100644 index 000000000000..e7c9cf81170e --- /dev/null +++ b/src/ImportExport/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/EventsExtensions.cs b/src/ImportExport/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..9e9fb65560d2 --- /dev/null +++ b/src/ImportExport/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Extensions.cs b/src/ImportExport/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..7bd18a19a52d --- /dev/null +++ b/src/ImportExport/generated/runtime/Extensions.cs @@ -0,0 +1,111 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System.Linq; + + internal static partial class Extensions + { + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => headerName == each.Key).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/ImportExport/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..6b02f559f00d --- /dev/null +++ b/src/ImportExport/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/ImportExport/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..0c6cd759795b --- /dev/null +++ b/src/ImportExport/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Helpers/Seperator.cs b/src/ImportExport/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..c7608071aae9 --- /dev/null +++ b/src/ImportExport/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Helpers/TypeDetails.cs b/src/ImportExport/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..1d381599c591 --- /dev/null +++ b/src/ImportExport/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Helpers/XHelper.cs b/src/ImportExport/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..54227ec533ce --- /dev/null +++ b/src/ImportExport/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/HttpPipeline.cs b/src/ImportExport/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..630345d52091 --- /dev/null +++ b/src/ImportExport/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/ImportExport/generated/runtime/HttpPipelineMocking.ps1 b/src/ImportExport/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..d16d04b6db2e --- /dev/null +++ b/src/ImportExport/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/ImportExport/generated/runtime/IAssociativeArray.cs b/src/ImportExport/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..305fbf448bb5 --- /dev/null +++ b/src/ImportExport/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + int Count { get; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/IHeaderSerializable.cs b/src/ImportExport/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..9787e020a4e2 --- /dev/null +++ b/src/ImportExport/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/ISendAsync.cs b/src/ImportExport/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..1132eeb4aca5 --- /dev/null +++ b/src/ImportExport/generated/runtime/ISendAsync.cs @@ -0,0 +1,289 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/InfoAttribute.cs b/src/ImportExport/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..d9d11f4f0ce9 --- /dev/null +++ b/src/ImportExport/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Iso/IsoDate.cs b/src/ImportExport/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..fd1af8fe5afb --- /dev/null +++ b/src/ImportExport/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/ImportExport/generated/runtime/JsonType.cs b/src/ImportExport/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..265e7c799728 --- /dev/null +++ b/src/ImportExport/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Method.cs b/src/ImportExport/generated/runtime/Method.cs new file mode 100644 index 000000000000..18ea375e0316 --- /dev/null +++ b/src/ImportExport/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Models/JsonMember.cs b/src/ImportExport/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..c87e2607daf1 --- /dev/null +++ b/src/ImportExport/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Models/JsonModel.cs b/src/ImportExport/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..9d369e7d350c --- /dev/null +++ b/src/ImportExport/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Models/JsonModelCache.cs b/src/ImportExport/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..8e941067700c --- /dev/null +++ b/src/ImportExport/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/Collections/JsonArray.cs b/src/ImportExport/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..23a7caefa5e1 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/ImportExport/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..f82ed68543a8 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/Collections/XList.cs b/src/ImportExport/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..6f0b904178fa --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/ImportExport/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..4d8875c7c9a3 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/Collections/XSet.cs b/src/ImportExport/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..4631859bd2f6 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonBoolean.cs b/src/ImportExport/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..869f71054115 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonDate.cs b/src/ImportExport/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..a45e80ebd7e7 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonNode.cs b/src/ImportExport/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..6a69c2ce1798 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonNumber.cs b/src/ImportExport/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..fc32ec75ca00 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonObject.cs b/src/ImportExport/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..b7eb67e84d6f --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/JsonString.cs b/src/ImportExport/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..96722a5a1570 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/XBinary.cs b/src/ImportExport/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..91e422419795 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Nodes/XNull.cs b/src/ImportExport/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..9859915a1d93 --- /dev/null +++ b/src/ImportExport/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/Exceptions/ParseException.cs b/src/ImportExport/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..b2b4e38921c1 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/JsonParser.cs b/src/ImportExport/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..9c90848f04d3 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/JsonToken.cs b/src/ImportExport/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..1e53b53e4e40 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/JsonTokenizer.cs b/src/ImportExport/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..9de4f8276f29 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/Location.cs b/src/ImportExport/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..6e606bdb2123 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/Readers/SourceReader.cs b/src/ImportExport/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..42af8b6443fa --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Parser/TokenReader.cs b/src/ImportExport/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..fc28dd815356 --- /dev/null +++ b/src/ImportExport/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/PipelineMocking.cs b/src/ImportExport/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..f08fbd8eec0a --- /dev/null +++ b/src/ImportExport/generated/runtime/PipelineMocking.cs @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result); + + internal static JsonNode SerializeContent(byte[] content) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (content.EndsWith("==")) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content) }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content) }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"))) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"))) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Response.cs b/src/ImportExport/generated/runtime/Response.cs new file mode 100644 index 000000000000..9e3002a25ed8 --- /dev/null +++ b/src/ImportExport/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Serialization/JsonSerializer.cs b/src/ImportExport/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..d76367482dbd --- /dev/null +++ b/src/ImportExport/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Serialization/PropertyTransformation.cs b/src/ImportExport/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..838d27f34940 --- /dev/null +++ b/src/ImportExport/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Serialization/SerializationOptions.cs b/src/ImportExport/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..db4bec2c49b9 --- /dev/null +++ b/src/ImportExport/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/SerializationMode.cs b/src/ImportExport/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..2b6be1ea6d07 --- /dev/null +++ b/src/ImportExport/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/TypeConverterExtensions.cs b/src/ImportExport/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..732c535b1af2 --- /dev/null +++ b/src/ImportExport/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,190 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + } +} diff --git a/src/ImportExport/generated/runtime/UndeclaredResponseException.cs b/src/ImportExport/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..1c0ed4c8bb7f --- /dev/null +++ b/src/ImportExport/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json.JsonObject; + + // see if there is an error block in the body + json = json.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // we'll create one below. + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/ImportExport/generated/runtime/Writers/JsonWriter.cs b/src/ImportExport/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..725f385c8724 --- /dev/null +++ b/src/ImportExport/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/ImportExport/generated/runtime/delegates.cs b/src/ImportExport/generated/runtime/delegates.cs new file mode 100644 index 000000000000..be6c037ef971 --- /dev/null +++ b/src/ImportExport/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/ImportExport/help/Az.ImportExport.md b/src/ImportExport/help/Az.ImportExport.md new file mode 100644 index 000000000000..357430fda6e0 --- /dev/null +++ b/src/ImportExport/help/Az.ImportExport.md @@ -0,0 +1,38 @@ +--- +Module Name: Az.ImportExport +Module Guid: 47cfc32b-a3bc-46e1-935e-11a63032bb86 +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.importexport +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.ImportExport Module +## Description +Microsoft Azure PowerShell: ImportExport cmdlets + +## Az.ImportExport Cmdlets +### [Get-AzImportExport](Get-AzImportExport.md) +Gets information about an existing job. + +### [Get-AzImportExportBitLockerKey](Get-AzImportExportBitLockerKey.md) +Returns the BitLocker Keys for all drives in the specified job. + +### [Get-AzImportExportLocation](Get-AzImportExportLocation.md) +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. + +### [New-AzImportExport](New-AzImportExport.md) +Creates a new job or updates an existing job in the specified subscription. + +### [New-AzImportExportDriveListObject](New-AzImportExportDriveListObject.md) +Create a DriverList Object for ImportExport. + +### [Remove-AzImportExport](Remove-AzImportExport.md) +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. + +### [Update-AzImportExport](Update-AzImportExport.md) +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. + diff --git a/src/ImportExport/help/Get-AzImportExport.md b/src/ImportExport/help/Get-AzImportExport.md new file mode 100644 index 000000000000..2795158c7570 --- /dev/null +++ b/src/ImportExport/help/Get-AzImportExport.md @@ -0,0 +1,237 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexport +schema: 2.0.0 +--- + +# Get-AzImportExport + +## SYNOPSIS +Gets information about an existing job. + +## SYNTAX + +### List (Default) +``` +Get-AzImportExport [-SubscriptionId ] [-Filter ] [-Top ] [-AcceptLanguage ] + [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzImportExport -Name -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzImportExport -InputObject [-AcceptLanguage ] + [-DefaultProfile ] [] +``` + +### List1 +``` +Get-AzImportExport -ResourceGroupName [-SubscriptionId ] [-Filter ] [-Top ] + [-AcceptLanguage ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Gets information about an existing job. + +## EXAMPLES + +### Example 1: Get ImportExport job with default context +```powershell +PS C:\> Get-AzImportExport +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet gets ImportExport job with default context. + +### Example 2: Get ImportExport job by resource group and job name +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet gets ImportExport job by resource group and job name. + +### Example 3: Lists all the ImportExport jobs in specified resource group +```powershell +PS C:\> Get-AzImportExport -ResourceGroupName ImportTestRG +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet lists all the ImportExport jobs in specified resource group. + +### Example 4: Get ImportExport job by identity +```powershell +PS C:\> $Id = "/subscriptions//resourceGroups/ImportTestRG/providers/Microsoft.ImportExport/jobs/test-job" +PS C:\> Get-AzImportExport -InputObject $Id +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet lists gets ImportExport job by identity. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Filter +Can be used to restrict the results to certain conditions. + +```yaml +Type: System.String +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the import/export job. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: JobName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name uniquely identifies the resource group within the user subscription. + +```yaml +Type: System.String +Parameter Sets: Get, List1 +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription ID for the Azure user. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Top +An integer value that specifies how many jobs at most should be returned. +The value cannot exceed 100. + +```yaml +Type: System.Int32 +Parameter Sets: List, List1 +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[JobName ]`: The name of the import/export job. + - `[LocationName ]`: The name of the location. For example, West US or westus. + - `[ResourceGroupName ]`: The resource group name uniquely identifies the resource group within the user subscription. + - `[SubscriptionId ]`: The subscription ID for the Azure user. + +## RELATED LINKS + diff --git a/src/ImportExport/help/Get-AzImportExportBitLockerKey.md b/src/ImportExport/help/Get-AzImportExportBitLockerKey.md new file mode 100644 index 000000000000..b5219f2af65f --- /dev/null +++ b/src/ImportExport/help/Get-AzImportExportBitLockerKey.md @@ -0,0 +1,126 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +schema: 2.0.0 +--- + +# Get-AzImportExportBitLockerKey + +## SYNOPSIS +Returns the BitLocker Keys for all drives in the specified job. + +## SYNTAX + +``` +Get-AzImportExportBitLockerKey -JobName -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Returns the BitLocker Keys for all drives in the specified job. + +## EXAMPLES + +### Example 1: List all BitLocker Keys in specified ImportExport job +```powershell +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA +``` + +This cmdlet lists all BitLocker Keys in specified ImportExport job. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobName +The name of the import/export job. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name uniquely identifies the resource group within the user subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription ID for the Azure user. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/ImportExport/help/Get-AzImportExportLocation.md b/src/ImportExport/help/Get-AzImportExportLocation.md new file mode 100644 index 000000000000..41d69f7eeb50 --- /dev/null +++ b/src/ImportExport/help/Get-AzImportExportLocation.md @@ -0,0 +1,172 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportlocation +schema: 2.0.0 +--- + +# Get-AzImportExportLocation + +## SYNOPSIS +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. + +## SYNTAX + +### List (Default) +``` +Get-AzImportExportLocation [-AcceptLanguage ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzImportExportLocation -Name [-AcceptLanguage ] [-DefaultProfile ] + [] +``` + +### GetViaIdentity +``` +Get-AzImportExportLocation -InputObject [-AcceptLanguage ] + [-DefaultProfile ] [] +``` + +## DESCRIPTION +Returns the details about a location to which you can ship the disks associated with an import or export job. +A location is an Azure region. + +## EXAMPLES + +### Example 1: Get all Azure region location details with default context +```powershell +PS C:\> Get-AzImportExportLocation +Name Type +---- ---- +Australia East Microsoft.ImportExport/locations +Australia Southeast Microsoft.ImportExport/locations +Brazil South Microsoft.ImportExport/locations +Canada Central Microsoft.ImportExport/locations +Canada East Microsoft.ImportExport/locations +... +West Central US Microsoft.ImportExport/locations +West Europe Microsoft.ImportExport/locations +West India Microsoft.ImportExport/locations +West US Microsoft.ImportExport/locations +West US 2 Microsoft.ImportExport/locations +``` + +This cmdlet gets all Azure region location details with default context. + +### Example 2: Get Azure region location details by location name +```powershell +PS C:\> Get-AzImportExportLocation -Name eastus +Name Type +---- ---- +East US Microsoft.ImportExport/locations +``` + +This cmdlet gets Azure region location details by location name. + +### Example 3: Get Azure region location details by identity +```powershell +PS C:\> $Id = "/providers/Microsoft.ImportExport/locations/eastus" +PS C:\> Get-AzImportExportLocation -InputObject $Id +Name Type +---- ---- +East US Microsoft.ImportExport/locations +``` + +This cmdlet lists gets Azure region location details by identity. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the location. +For example, West US or westus. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: LocationName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.ILocation + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[JobName ]`: The name of the import/export job. + - `[LocationName ]`: The name of the location. For example, West US or westus. + - `[ResourceGroupName ]`: The resource group name uniquely identifies the resource group within the user subscription. + - `[SubscriptionId ]`: The subscription ID for the Azure user. + +## RELATED LINKS + diff --git a/src/ImportExport/help/New-AzImportExport.md b/src/ImportExport/help/New-AzImportExport.md new file mode 100644 index 000000000000..556b4c12de7a --- /dev/null +++ b/src/ImportExport/help/New-AzImportExport.md @@ -0,0 +1,860 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-azimportexport +schema: 2.0.0 +--- + +# New-AzImportExport + +## SYNOPSIS +Creates a new job or updates an existing job in the specified subscription. + +## SYNTAX + +``` +New-AzImportExport -Name -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-ClientTenantId ] [-BackupDriveManifest] [-BlobListBlobPath ] + [-BlobListBlobPathPrefix ] [-CancelRequested] [-DeliveryPackageCarrierName ] + [-DeliveryPackageDriveCount ] [-DeliveryPackageShipDate ] + [-DeliveryPackageTrackingNumber ] [-DiagnosticsPath ] [-DriveList ] + [-ExportBlobListblobPath ] [-IncompleteBlobListUri ] [-JobType ] [-Location ] + [-LogLevel ] [-PercentComplete ] [-ProvisioningState ] [-ReturnAddressCity ] + [-ReturnAddressCountryOrRegion ] [-ReturnAddressEmail ] [-ReturnAddressPhone ] + [-ReturnAddressPostalCode ] [-ReturnAddressRecipientName ] + [-ReturnAddressStateOrProvince ] [-ReturnAddressStreetAddress1 ] + [-ReturnAddressStreetAddress2 ] [-ReturnPackageCarrierName ] + [-ReturnPackageDriveCount ] [-ReturnPackageShipDate ] [-ReturnPackageTrackingNumber ] + [-ReturnShippingCarrierAccountNumber ] [-ReturnShippingCarrierName ] + [-ShippingInformationCity ] [-ShippingInformationCountryOrRegion ] + [-ShippingInformationPhone ] [-ShippingInformationPostalCode ] + [-ShippingInformationRecipientName ] [-ShippingInformationStateOrProvince ] + [-ShippingInformationStreetAddress1 ] [-ShippingInformationStreetAddress2 ] [-State ] + [-StorageAccountId ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Creates a new job or updates an existing job in the specified subscription. + +## EXAMPLES + +### Example 1: Create a new ImportExport job +```powershell +PS C:\> $driveList = @( @{ DriveId = "9CA995BA"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) +PS C:\> New-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -Location eastus -StorageAccountId "/subscriptions//resourcegroups/ImportTestRG/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList +Location Name Type +-------- ---- ---- +eastus test-job Microsoft.ImportExport/jobs +``` + +These cmdlets create a new ImportExport job. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BackupDriveManifest +Default value is false. +Indicates whether the manifest files on the drives should be copied to block blobs. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlobListBlobPath +A collection of blob-path strings. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlobListBlobPathPrefix +A collection of blob-prefix strings. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CancelRequested +Indicates whether a request has been submitted to cancel the job. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ClientTenantId +The tenant ID of the client making the request. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageCarrierName +The name of the carrier that is used to ship the import or export drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageDriveCount +The number of drives included in the package. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageShipDate +The date when the package is shipped. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageTrackingNumber +The tracking number of the package. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DiagnosticsPath +The virtual blob directory to which the copy logs and backups of drive manifest files (if enabled) will be stored. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DriveList +List of up to ten drives that comprise the job. +The drive list is a required element for an import job; it is not specified for export jobs. +To construct, see NOTES section for DRIVELIST properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ExportBlobListblobPath +The relative URI to the block blob that contains the list of blob paths or blob path prefixes as defined above, beginning with the container name. +If the blob is in root container, the URI must begin with $root. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -IncompleteBlobListUri +A blob path that points to a block blob containing a list of blob names that were not exported due to insufficient drive space. +If all blobs were exported successfully, then this element is not included in the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -JobType +The type of job + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Specifies the supported Azure location where the job should be created + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -LogLevel +Default value is Error. +Indicates whether error logging or verbose logging will be enabled. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the import/export job. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: JobName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PercentComplete +Overall percentage completed for the job. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProvisioningState +Specifies the provisioning state of the job. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name uniquely identifies the resource group within the user subscription. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressCity +The city name to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressCountryOrRegion +The country or region to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressEmail +Email address of the recipient of the returned drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressPhone +Phone number of the recipient of the returned drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressPostalCode +The postal code to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressRecipientName +The name of the recipient who will receive the hard drives when they are returned. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStateOrProvince +The state or province to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStreetAddress1 +The first line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStreetAddress2 +The second line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnPackageCarrierName +The name of the carrier that is used to ship the import or export drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnPackageDriveCount +The number of drives included in the package. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnPackageShipDate +The date when the package is shipped. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnPackageTrackingNumber +The tracking number of the package. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnShippingCarrierAccountNumber +The customer's account number with the carrier. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnShippingCarrierName +The carrier's name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationCity +The city name to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationCountryOrRegion +The country or region to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationPhone +Phone number of the recipient of the returned drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationPostalCode +The postal code to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationRecipientName +The name of the recipient who will receive the hard drives when they are returned. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationStateOrProvince +The state or province to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationStreetAddress1 +The first line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ShippingInformationStreetAddress2 +The second line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +Current state of the job. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -StorageAccountId +The resource identifier of the storage account where data will be imported to or exported from. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription ID for the Azure user. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Specifies the tags that will be assigned to the job. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IPutJobParametersTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +DRIVELIST : List of up to ten drives that comprise the job. The drive list is a required element for an import job; it is not specified for export jobs. + - `[BitLockerKey ]`: The BitLocker key used to encrypt the drive. + - `[BytesSucceeded ]`: Bytes successfully transferred for the drive. + - `[CopyStatus ]`: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + - `[DriveHeaderHash ]`: The drive header hash value. + - `[DriveId ]`: The drive's hardware serial number, without spaces. + - `[ErrorLogUri ]`: A URI that points to the blob containing the error log for the data transfer operation. + - `[ManifestFile ]`: The relative path of the manifest file on the drive. + - `[ManifestHash ]`: The Base16-encoded MD5 hash of the manifest file on the drive. + - `[ManifestUri ]`: A URI that points to the blob containing the drive manifest file. + - `[PercentComplete ]`: Percentage completed for the drive. + - `[State ]`: The drive's current state. + - `[VerboseLogUri ]`: A URI that points to the blob containing the verbose log for the data transfer operation. + +## RELATED LINKS + diff --git a/src/ImportExport/help/New-AzImportExportDriveListObject.md b/src/ImportExport/help/New-AzImportExportDriveListObject.md new file mode 100644 index 000000000000..1ede9573fe4e --- /dev/null +++ b/src/ImportExport/help/New-AzImportExportDriveListObject.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/new-AzImportExportDriveListObject +schema: 2.0.0 +--- + +# New-AzImportExportDriveListObject + +## SYNOPSIS +Create a DriverList Object for ImportExport. + +## SYNTAX + +``` +New-AzImportExportDriveListObject [-BitLockerKey ] [-BytesSucceeded ] [-CopyStatus ] + [-DriveHeaderHash ] [-DriveId ] [-ErrorLogUri ] [-ManifestFile ] + [-ManifestHash ] [-ManifestUri ] [-PercentComplete ] [-State ] + [-VerboseLogUri ] [] +``` + +## DESCRIPTION +Create a DriverList Object for ImportExport. + +## EXAMPLES + +### Example 1: Create a new DriveList for ImportExport job +```powershell +PS C:\> New-AzImportExportDriveListObject -DriveId "9CA995BA" -BitLockerKey "238810-662376-448998-450120-652806-203390-606320-483076" -ManifestFile "\\DriveManifest.xml" -ManifestHash "109B21108597EF36D5785F08303F3638" + +BitLockerKey BytesSucceeded CopyStatus DriveHeaderHash DriveId ErrorLogUri ManifestFile ManifestHash ManifestUri PercentComplete State VerboseLogUri +------------ -------------- ---------- --------------- ------- ----------- ------------ ------------ ----------- --------------- ----- ------- +238810-662376-448998-450120-652806-203390-606320-483076 0 9CA995BA \\DriveManifest.xml 109B21108597EF36D5785F08303F3638 0 +``` + +These cmdlets create a new DriveList for ImportExport job. + +## PARAMETERS + +### -BitLockerKey +The BitLocker key used to encrypt the drive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BytesSucceeded +Bytes successfully transferred for the drive. + +```yaml +Type: System.Int64 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CopyStatus +Detailed status about the data transfer process. +This field is not returned in the response until the drive is in the Transferring state. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DriveHeaderHash +The drive header hash value. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DriveId +The drive's hardware serial number, without spaces. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ErrorLogUri +A URI that points to the blob containing the error log for the data transfer operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ManifestFile +The relative path of the manifest file on the drive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ManifestHash +The Base16-encoded MD5 hash of the manifest file on the drive. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ManifestUri +A URI that points to the blob containing the drive manifest file. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PercentComplete +Percentage completed for the drive. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +The drive's current state. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Support.DriveState +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -VerboseLogUri +A URI that points to the blob containing the verbose log for the data transfer operation. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/ImportExport/help/Remove-AzImportExport.md b/src/ImportExport/help/Remove-AzImportExport.md new file mode 100644 index 000000000000..6a61af2d73dd --- /dev/null +++ b/src/ImportExport/help/Remove-AzImportExport.md @@ -0,0 +1,216 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/remove-azimportexport +schema: 2.0.0 +--- + +# Remove-AzImportExport + +## SYNOPSIS +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzImportExport -Name -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzImportExport -InputObject [-AcceptLanguage ] + [-DefaultProfile ] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Deletes an existing job. +Only jobs in the Creating or Completed states can be deleted. + +## EXAMPLES + +### Example 1: Remove ImportExport job by resourceGroup and server name +```powershell +PS C:\> Remove-AzImportExport -Name test-job -ResourceGroupName ImportTestRG +``` + +This cmdlet removes ImportExport job by resourceGroup and server name. + +### Example 2: Remove ImportExport job by identity +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Remove-AzImportExport + +``` + +These cmdlet removes ImportExport job by identity. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +The name of the import/export job. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: JobName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name uniquely identifies the resource group within the user subscription. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription ID for the Azure user. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[JobName ]`: The name of the import/export job. + - `[LocationName ]`: The name of the location. For example, West US or westus. + - `[ResourceGroupName ]`: The resource group name uniquely identifies the resource group within the user subscription. + - `[SubscriptionId ]`: The subscription ID for the Azure user. + +## RELATED LINKS + diff --git a/src/ImportExport/help/Update-AzImportExport.md b/src/ImportExport/help/Update-AzImportExport.md new file mode 100644 index 000000000000..5f3128f9b7ed --- /dev/null +++ b/src/ImportExport/help/Update-AzImportExport.md @@ -0,0 +1,555 @@ +--- +external help file: +Module Name: Az.ImportExport +online version: https://docs.microsoft.com/en-us/powershell/module/az.importexport/update-azimportexport +schema: 2.0.0 +--- + +# Update-AzImportExport + +## SYNOPSIS +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzImportExport -Name -ResourceGroupName [-SubscriptionId ] + [-AcceptLanguage ] [-BackupDriveManifest] [-CancelRequested] [-DeliveryPackageCarrierName ] + [-DeliveryPackageDriveCount ] [-DeliveryPackageShipDate ] + [-DeliveryPackageTrackingNumber ] [-DriveList ] [-LogLevel ] + [-ReturnAddressCity ] [-ReturnAddressCountryOrRegion ] [-ReturnAddressEmail ] + [-ReturnAddressPhone ] [-ReturnAddressPostalCode ] [-ReturnAddressRecipientName ] + [-ReturnAddressStateOrProvince ] [-ReturnAddressStreetAddress1 ] + [-ReturnAddressStreetAddress2 ] [-ReturnShippingCarrierAccountNumber ] + [-ReturnShippingCarrierName ] [-State ] [-Tag ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzImportExport -InputObject [-AcceptLanguage ] [-BackupDriveManifest] + [-CancelRequested] [-DeliveryPackageCarrierName ] [-DeliveryPackageDriveCount ] + [-DeliveryPackageShipDate ] [-DeliveryPackageTrackingNumber ] [-DriveList ] + [-LogLevel ] [-ReturnAddressCity ] [-ReturnAddressCountryOrRegion ] + [-ReturnAddressEmail ] [-ReturnAddressPhone ] [-ReturnAddressPostalCode ] + [-ReturnAddressRecipientName ] [-ReturnAddressStateOrProvince ] + [-ReturnAddressStreetAddress1 ] [-ReturnAddressStreetAddress2 ] + [-ReturnShippingCarrierAccountNumber ] [-ReturnShippingCarrierName ] [-State ] + [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Updates specific properties of a job. +You can call this operation to notify the Import/Export service that the hard drives comprising the import or export job have been shipped to the Microsoft data center. +It can also be used to cancel an existing job. + +## EXAMPLES + +### Example 1: Update ImportExport job by resource group and server name +```powershell +PS C:\> Update-AzImportExport -Name test-job -ResourceGroupName ImportTestRG -DeliveryPackageCarrierName pwsh -DeliveryPackageTrackingNumber pwsh20200000 +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet updates ImportExport job by resource group and server name. + +### Example 2: Update ImportExport job by identity. +```powershell +PS C:\> Get-AzImportExport -Name test-job -ResourceGroupName ImportTestRG | Update-AzImportExport -CancelRequested +Location Name Type +-------- ---- ---- +East US test-job Microsoft.ImportExport/jobs +``` + +This cmdlet updates ImportExport job by identity. + +## PARAMETERS + +### -AcceptLanguage +Specifies the preferred language for the response. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BackupDriveManifest +Indicates whether the manifest files on the drives should be copied to block blobs. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -CancelRequested +If specified, the value must be true. +The service will attempt to cancel the job. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageCarrierName +The name of the carrier that is used to ship the import or export drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageDriveCount +The number of drives included in the package. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageShipDate +The date when the package is shipped. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DeliveryPackageTrackingNumber +The tracking number of the package. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DriveList +List of drives that comprise the job. +To construct, see NOTES section for DRIVELIST properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveStatus[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -LogLevel +Indicates whether error logging or verbose logging is enabled. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The name of the import/export job. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: JobName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name uniquely identifies the resource group within the user subscription. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressCity +The city name to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressCountryOrRegion +The country or region to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressEmail +Email address of the recipient of the returned drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressPhone +Phone number of the recipient of the returned drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressPostalCode +The postal code to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressRecipientName +The name of the recipient who will receive the hard drives when they are returned. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStateOrProvince +The state or province to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStreetAddress1 +The first line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnAddressStreetAddress2 +The second line of the street address to use when returning the drives. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnShippingCarrierAccountNumber +The customer's account number with the carrier. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ReturnShippingCarrierName +The carrier's name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -State +If specified, the value must be Shipping, which tells the Import/Export service that the package for the job has been shipped. +The ReturnAddress and DeliveryPackage properties must have been set either in this request or in a previous request, otherwise the request will fail. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +The subscription ID for the Azure user. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Specifies the tags that will be assigned to the job + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IUpdateJobParametersTags +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.IImportExportIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IJobResponse + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +DRIVELIST : List of drives that comprise the job. + - `[BitLockerKey ]`: The BitLocker key used to encrypt the drive. + - `[BytesSucceeded ]`: Bytes successfully transferred for the drive. + - `[CopyStatus ]`: Detailed status about the data transfer process. This field is not returned in the response until the drive is in the Transferring state. + - `[DriveHeaderHash ]`: The drive header hash value. + - `[DriveId ]`: The drive's hardware serial number, without spaces. + - `[ErrorLogUri ]`: A URI that points to the blob containing the error log for the data transfer operation. + - `[ManifestFile ]`: The relative path of the manifest file on the drive. + - `[ManifestHash ]`: The Base16-encoded MD5 hash of the manifest file on the drive. + - `[ManifestUri ]`: A URI that points to the blob containing the drive manifest file. + - `[PercentComplete ]`: Percentage completed for the drive. + - `[State ]`: The drive's current state. + - `[VerboseLogUri ]`: A URI that points to the blob containing the verbose log for the data transfer operation. + +INPUTOBJECT : Identity Parameter + - `[Id ]`: Resource identity path + - `[JobName ]`: The name of the import/export job. + - `[LocationName ]`: The name of the location. For example, West US or westus. + - `[ResourceGroupName ]`: The resource group name uniquely identifies the resource group within the user subscription. + - `[SubscriptionId ]`: The subscription ID for the Azure user. + +## RELATED LINKS + diff --git a/src/ImportExport/how-to.md b/src/ImportExport/how-to.md new file mode 100644 index 000000000000..babfd21f4ca1 --- /dev/null +++ b/src/ImportExport/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.ImportExport`. + +## Building `Az.ImportExport` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. + +## Testing `Az.ImportExport` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. + +## Packing `Az.ImportExport` +To pack `Az.ImportExport` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.ImportExport`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.ImportExport.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.ImportExport.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.ImportExport`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.ImportExport` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/ImportExport/internal/Az.ImportExport.internal.psm1 b/src/ImportExport/internal/Az.ImportExport.internal.psm1 new file mode 100644 index 000000000000..314853deca06 --- /dev/null +++ b/src/ImportExport/internal/Az.ImportExport.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.ImportExport.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/ImportExport/internal/Get-AzImportExportBitLockerKey.ps1 b/src/ImportExport/internal/Get-AzImportExportBitLockerKey.ps1 new file mode 100644 index 000000000000..0dd3b48f1ff1 --- /dev/null +++ b/src/ImportExport/internal/Get-AzImportExportBitLockerKey.ps1 @@ -0,0 +1,146 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the BitLocker Keys for all drives in the specified job. +.Description +Returns the BitLocker Keys for all drives in the specified job. +.Example +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +#> +function Get-AzImportExportBitLockerKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${JobName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.private\Get-AzImportExportBitLockerKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/internal/Get-AzOperation.ps1 b/src/ImportExport/internal/Get-AzOperation.ps1 new file mode 100644 index 000000000000..c7a90321efde --- /dev/null +++ b/src/ImportExport/internal/Get-AzOperation.ps1 @@ -0,0 +1,127 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the list of operations supported by the import/export resource provider. +.Description +Returns the list of operations supported by the import/export resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azoperation +#> +function Get-AzOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.private\Get-AzOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/internal/ProxyCmdletDefinitions.ps1 b/src/ImportExport/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..dd75d37304e8 --- /dev/null +++ b/src/ImportExport/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,273 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the BitLocker Keys for all drives in the specified job. +.Description +Returns the BitLocker Keys for all drives in the specified job. +.Example +PS C:\> Get-AzImportExportBitLockerKey -JobName test-job -ResourceGroupName ImportTestRG +BitLockerKey DriveId +------------ ------- +238810-662376-448998-450120-652806-203390-606320-483076 9CA995BA + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azimportexportbitlockerkey +#> +function Get-AzImportExportBitLockerKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IDriveBitLockerKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The name of the import/export job. + ${JobName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [System.String] + # The resource group name uniquely identifies the resource group within the user subscription. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # The subscription ID for the Azure user. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.private\Get-AzImportExportBitLockerKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Returns the list of operations supported by the import/export resource provider. +.Description +Returns the list of operations supported by the import/export resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.importexport/get-azoperation +#> +function Get-AzOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Models.Api20161101.IOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Header')] + [System.String] + # Specifies the preferred language for the response. + ${AcceptLanguage}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.ImportExport.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.ImportExport.private\Get-AzOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/ImportExport/internal/readme.md b/src/ImportExport/internal/readme.md new file mode 100644 index 000000000000..1bb7d2a1f16c --- /dev/null +++ b/src/ImportExport/internal/readme.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.ImportExport.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.ImportExport`. Instead, this sub-module is imported by the `..\custom\Az.ImportExport.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.ImportExport.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.ImportExport`. \ No newline at end of file diff --git a/src/ImportExport/pack-module.ps1 b/src/ImportExport/pack-module.ps1 new file mode 100644 index 000000000000..c22fad33d87b --- /dev/null +++ b/src/ImportExport/pack-module.ps1 @@ -0,0 +1,16 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImportExport/readme.md b/src/ImportExport/readme.md new file mode 100644 index 000000000000..2c693068824d --- /dev/null +++ b/src/ImportExport/readme.md @@ -0,0 +1,72 @@ + +# Az.ImportExport +This directory contains the PowerShell module for the ImportExport service. + +--- +## Status +[![Az.ImportExport](https://img.shields.io/powershellgallery/v/Az.ImportExport.svg?style=flat-square&label=Az.ImportExport "Az.ImportExport")](https://www.powershellgallery.com/packages/Az.ImportExport/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.7.4 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.ImportExport`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  +## Run Generation +In this directory, run AutoRest: +> `autorest` +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/storageimportexport/resource-manager/Microsoft.ImportExport/stable/2016-11-01/storageimportexport.json +title: ImportExport +module-version: 0.1.0 +subject-prefix: '' +directive: + - where: + variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Update$|^UpdateViaIdentity$ + remove: true + - where: + subject: Job + set: + subject: ImportExport + - where: + subject: Location + set: + subject: ImportExportLocation + - where: + subject: BitLockerKey + set: + subject: ImportExportBitLockerKey + hide: true +``` diff --git a/src/ImportExport/run-module.ps1 b/src/ImportExport/run-module.ps1 new file mode 100644 index 000000000000..10f1643c2965 --- /dev/null +++ b/src/ImportExport/run-module.ps1 @@ -0,0 +1,59 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImportExport.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/ImportExport/test-module.ps1 b/src/ImportExport/test-module.ps1 new file mode 100644 index 000000000000..9eb9cb3e6abb --- /dev/null +++ b/src/ImportExport/test-module.ps1 @@ -0,0 +1,68 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) { + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.ImportExport.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +if($Live) { + $TestMode = 'live' +} +if($Record) { + $TestMode = 'record' +} +try { + if ($TestMode -ne 'playback') { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + Invoke-Pester -Script @{ Path = $testFolder } -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") +} +Finally +{ + if ($TestMode -ne 'playback') { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/ImportExport/test/Get-AzImportExport.Recording.json b/src/ImportExport/test/Get-AzImportExport.Recording.json new file mode 100644 index 000000000000..9d0cb9500ef9 --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExport.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzImportExport+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.ImportExport/jobs?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.ImportExport/jobs?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "23" ], + "x-ms-client-request-id": [ "e7c693b2-0341-4bba-a852-943c24554a58" ], + "CommandName": [ "Get-AzImportExport" ], + "FullCommandName": [ "Get-AzImportExport_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "84187c12-2361-46dd-aae0-a84981a26e6f" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11993" ], + "x-ms-correlation-request-id": [ "f517d84f-c2ba-46e6-bc31-4f30ccefb060" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101450Z:f517d84f-c2ba-46e6-bc31-4f30ccefb060" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1289" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BB\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}]}" + } + }, + "Get-AzImportExport+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "24" ], + "x-ms-client-request-id": [ "090cac1c-03ec-49f1-b091-086a3211794a" ], + "CommandName": [ "Get-AzImportExport" ], + "FullCommandName": [ "Get-AzImportExport_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d78358c2-fb1f-4d7c-bf35-4a79073de542" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11992" ], + "x-ms-correlation-request-id": [ "273429d6-6db8-487e-8987-56655bb20617" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101451Z:273429d6-6db8-487e-8987-56655bb20617" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1277" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BB\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}" + } + }, + "Get-AzImportExport+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "25" ], + "x-ms-client-request-id": [ "1ca01a34-8521-4213-a25e-a32c00158454" ], + "CommandName": [ "Get-AzImportExport" ], + "FullCommandName": [ "Get-AzImportExport_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "46cab599-7e4b-4a09-a81b-4c7879cafc15" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11991" ], + "x-ms-correlation-request-id": [ "2505a768-d1e3-4675-bf13-c17e5ca347e3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101452Z:2505a768-d1e3-4675-bf13-c17e5ca347e3" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1122" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}]}" + } + }, + "Get-AzImportExport+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "26" ], + "x-ms-client-request-id": [ "0e77fee7-9886-40d5-8147-aa05aa2cb179" ], + "CommandName": [ "Get-AzImportExport" ], + "FullCommandName": [ "Get-AzImportExport_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "3a5aff5c-eb45-4bf6-bbc3-166099cf791a" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11990" ], + "x-ms-correlation-request-id": [ "e55e8a27-9972-409d-8142-ab1e794bd00a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101453Z:e55e8a27-9972-409d-8142-ab1e794bd00a" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1277" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BB\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/Get-AzImportExport.Tests.ps1 b/src/ImportExport/test/Get-AzImportExport.Tests.ps1 new file mode 100644 index 000000000000..07b1a45c6a4d --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExport.Tests.ps1 @@ -0,0 +1,35 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzImportExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzImportExport' { + It 'List' { + $job = Get-AzImportExport + $job.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $job = Get-AzImportExport -Name $env.jobName -ResourceGroupName $env.resourceGroup + $job.Name | Should -Be $env.jobName + } + + It 'List1' { + $job = Get-AzImportExport -ResourceGroupName $env.resourceGroup + $job.Count | Should -BeGreaterOrEqual 1 + } + + It 'GetViaIdentity' { + $Id = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)/providers/Microsoft.ImportExport/jobs/$($env.jobName)" + $job = Get-AzImportExport -InputObject $Id + $job.Name | Should -Be $env.jobName + } +} diff --git a/src/ImportExport/test/Get-AzImportExportBitLockerKey.Recording.json b/src/ImportExport/test/Get-AzImportExportBitLockerKey.Recording.json new file mode 100644 index 000000000000..5d4049e4bdb3 --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExportBitLockerKey.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzImportExportBitLockerKey+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job/listBitLockerKeys?api-version=2016-11-01+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job/listBitLockerKeys?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "27" ], + "x-ms-client-request-id": [ "686b8203-fcab-47e8-8f1d-36f4c714b44e" ], + "CommandName": [ "Get-AzImportExportBitLockerKey" ], + "FullCommandName": [ "Get-AzImportExportBitLockerKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "0eaf1aa4-74c7-4dec-841e-8eb98b956d49" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "x-ms-correlation-request-id": [ "f7342150-c248-4011-b246-e7b7baa26aa7" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101454Z:f7342150-c248-4011-b246-e7b7baa26aa7" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "107" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"driveId\":\"9CA995BB\",\"bitLockerKey\":\"238810-662376-448998-450120-652806-203390-606320-483076\"}]}" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/Get-AzImportExportBitLockerKey.Tests.ps1 b/src/ImportExport/test/Get-AzImportExportBitLockerKey.Tests.ps1 new file mode 100644 index 000000000000..8d7996e01929 --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExportBitLockerKey.Tests.ps1 @@ -0,0 +1,20 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzImportExportBitLockerKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzImportExportBitLockerKey' { + It 'List' { + $key = Get-AzImportExportBitLockerKey -JobName $env.jobName -ResourceGroupName $env.resourceGroup + $key.DriveId | Should -Be 9CA995BB + $key.BitLockerKey | Should -Be 238810-662376-448998-450120-652806-203390-606320-483076 + } +} diff --git a/src/ImportExport/test/Get-AzImportExportLocation.Recording.json b/src/ImportExport/test/Get-AzImportExportLocation.Recording.json new file mode 100644 index 000000000000..a9a44451401e --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExportLocation.Recording.json @@ -0,0 +1,119 @@ +{ + "Get-AzImportExportLocation+[NoContext]+List+$GET+https://management.azure.com/providers/Microsoft.ImportExport/locations?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.ImportExport/locations?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "28" ], + "x-ms-client-request-id": [ "55b43f43-0c39-4f82-b648-d06a38476746" ], + "CommandName": [ "Get-AzImportExportLocation" ], + "FullCommandName": [ "Get-AzImportExportLocation_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "35c6944e-2449-4ce7-b071-476565528cca" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11998" ], + "x-ms-correlation-request-id": [ "8c5ec6de-7e75-4e9a-acf9-2c435ae4fde8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101455Z:8c5ec6de-7e75-4e9a-acf9-2c435ae4fde8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "16814" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"properties\":{\"recipientName\":\"This DC has security requirements requiring advance notification for all inbound shipments. Contact adbops@microsoft.com specifying your order name to receive the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" \",\"phone\":\" \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiaeast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/australiaeast\",\"name\":\"Australia East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This DC has security requirements requiring advance notification for all inbound shipments. Contact adbops@microsoft.com specifying your order name to receive the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" \",\"phone\":\" \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiasoutheast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/australiasoutheast\",\"name\":\"Australia Southeast\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o AscentyRua Papa Joao Paulo II 4 - Jardim Santa Izabel\",\"streetAddress2\":\"Hortolândia\",\"city\":\"São Paulo\",\"stateOrProvince\":\"\",\"postalCode\":\"CEP: 13.185-252\",\"countryOrRegion\":\"Brazil\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/brazilsouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/brazilsouth\",\"name\":\"Brazil South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o Allied Properties REIT 35 John St\",\"streetAddress2\":\"\",\"city\":\"West Toronto\",\"stateOrProvince\":\"ON\",\"postalCode\":\"M5V 3G6\",\"countryOrRegion\":\"Canada\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/canadacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/canadacentral\",\"name\":\"Canada Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 4 Degrees 2675 Boulevard du Parc-Technologique\",\"streetAddress2\":\"\",\"city\":\"Quebec City\",\"stateOrProvince\":\"QC\",\"postalCode\":\"G1P 4S5\",\"countryOrRegion\":\"Canada\",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/canadacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/canadaeast\",\"name\":\"Canada East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Corp. (India) Pvt. Ltd. c/o Tata Communications Ltd., IDC Building, 2nd floor, Alandi Road\",\"streetAddress2\":\"\",\"city\":\"Dighi, Pune\",\"stateOrProvince\":\"Mahar\",\"postalCode\":\"411015\",\"countryOrRegion\":\"India\",\"phone\":\"+91-8956884068\",\"supportedCarriers\":[\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/centralindia\",\"name\":\"Central India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"550 SE White Crane Rd\",\"streetAddress2\":\"\",\"city\":\"West Des Moines\",\"stateOrProvince\":\"IA\",\"postalCode\":\"50265\",\"countryOrRegion\":\"USA\",\"phone\":\"5156975500\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/centralus\",\"name\":\"Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"\\n Microsoft c/o NTT Comm 6 Chun Kwong Street, Tseung Kwan O Industrial Estate \",\"streetAddress2\":\"\",\"city\":\"Tseung Kwan O\",\"stateOrProvince\":\"\",\"postalCode\":\"\",\"countryOrRegion\":\"\",\"phone\":\"+852 3793 0508\\n \",\"supportedCarriers\":[\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastasia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastasia\",\"name\":\"East Asia\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus\",\"name\":\"East US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"101 Herbert Drive, BLDG 7\",\"streetAddress2\":\"\",\"city\":\"Boydton\",\"stateOrProvince\":\"VA\",\"postalCode\":\"23917\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus2\",\"name\":\"East US 2\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/francecentral\",\"name\":\"France Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/germanynorth\",\"name\":\"Germany North\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/germanywestcentral\",\"name\":\"Germany West Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft C/O NTT Communications 2-7-5, Tabatashinmachi, Kita-ku\",\"streetAddress2\":\"\",\"city\":\"Tokyo\",\"stateOrProvince\":\"\",\"postalCode\":\"114-0012\",\"countryOrRegion\":\"Japan\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/japaneast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/japaneast\",\"name\":\"Japan East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft C/O NTT Communications3-1-21, Dojima Kita-ku\",\"streetAddress2\":\"\",\"city\":\"Osaka City\",\"stateOrProvince\":\"Osaka\",\"postalCode\":\"553-0003\",\"countryOrRegion\":\"Japan\",\"phone\":\"+81 (6) 7670-6655\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/japanwest\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/japanwest\",\"name\":\"Japan West\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 29, Simindaero-327gil, Dong An-gu\",\"streetAddress2\":\"Anyang-si\",\"city\":\"Kyeonggido\",\"stateOrProvince\":\"\",\"postalCode\":\"14055\",\"countryOrRegion\":\"Republic of Korea\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/koreacentral\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/koreacentral\",\"name\":\"Korea Central\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o 29, Simindaero-327gil, Dong An-gu\",\"streetAddress2\":\"Anyang-si\",\"city\":\"Kyeonggido\",\"stateOrProvince\":\"\",\"postalCode\":\"14055\",\"countryOrRegion\":\"Republic of Korea\",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/australiasoutheast\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/koreasouth\",\"name\":\"Korea South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"601 Northwest Ave.\",\"streetAddress2\":\"\",\"city\":\"Northlake\",\"stateOrProvince\":\"IL\",\"postalCode\":\"60164\",\"countryOrRegion\":\"USA\",\"phone\":\"(708) 836-5143\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/northcentralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/northcentralus\",\"name\":\"North Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Unit 74 Grange Castle Business Park, Clondalkin\",\"streetAddress2\":\"\",\"city\":\"Dublin\",\"stateOrProvince\":\"\",\"postalCode\":\"22\",\"countryOrRegion\":\"Ireland (IE)\",\"phone\":\"8886052200\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/northeurope\",\"name\":\"North Europe\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/norwayeast\",\"name\":\"Norway East\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"5150 Rogers Road\",\"streetAddress2\":\"\",\"city\":\"San Antonio\",\"stateOrProvince\":\"TX\",\"postalCode\":\"78251\",\"countryOrRegion\":\"USA\",\"phone\":\"+1 210 3462528\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southcentralus\",\"name\":\"South Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Corp. (India) Pvt. Ltd. C/o Tata Communications Ltd, 226 Red Hills Road, Kallikuppam\",\"streetAddress2\":\"\",\"city\":\"Ambattur\",\"stateOrProvince\":\"Tamil Nadu\",\"postalCode\":\"600053\",\"countryOrRegion\":\"India\",\"phone\":\"+91 7200090173\",\"supportedCarriers\":[\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/southindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southindia\",\"name\":\"South India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21 Defu Ave 1\",\"streetAddress2\":\"\",\"city\":\"Singapore\",\"stateOrProvince\":\"539539\",\"postalCode\":\"Singapore (SG)\",\"countryOrRegion\":\"+659017 9066\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/southeastasia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/southeastasia\",\"name\":\"Southeast Asia\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/switzerlandnorth\",\"name\":\"Switzerland North\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"FedEx\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/switzerlandwest\",\"name\":\"Switzerland West\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This DC has security requirements requiring advance notification for all inbound shipments. Contact adbops@microsoft.com specifying your order name to receive the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" \",\"phone\":\" \",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/uksouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/uksouth\",\"name\":\"UK South\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"This DC has security requirements requiring advance notification for all inbound shipments. Contact adbops@microsoft.com specifying your order name to receive the unique inbound ID and shipping address\",\"streetAddress1\":\" \",\"streetAddress2\":\" \",\"city\":\" \",\"stateOrProvince\":\" \",\"postalCode\":\" \",\"countryOrRegion\":\" \",\"phone\":\" \",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/uksouth\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/ukwest\",\"name\":\"UK West\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft 638 Logistics Drive\",\"streetAddress2\":\"\",\"city\":\"Cheyenne\",\"stateOrProvince\":\"WY\",\"postalCode\":\"82007\",\"countryOrRegion\":\"USA\",\"supportedCarriers\":[\"FedEx\",\"DHL\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westcentralus\",\"name\":\"West Central US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft Agriport 570\",\"streetAddress2\":\"\",\"city\":\"Middenmeer\",\"stateOrProvince\":\"NL-NH\",\"postalCode\":\"1775TB\",\"countryOrRegion\":\"Netherlands (NL)\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westeurope\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westeurope\",\"name\":\"West Europe\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"Microsoft c/o Tata Communications,Tower A , 6th Floor,Plot # C21 C36, Bandra Kurla Complex, Near MTNL\",\"streetAddress2\":\"\",\"city\":\"Mumbai\",\"stateOrProvince\":\"Maharashtra\",\"postalCode\":\"400098\",\"countryOrRegion\":\"India\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/centralindia\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westindia\",\"name\":\"West India\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"3020 Coronado\",\"streetAddress2\":\"\",\"city\":\"Santa Clara\",\"stateOrProvince\":\"CA\",\"postalCode\":\"95054\",\"countryOrRegion\":\"USA\",\"phone\":\"408 352 7600\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westus\",\"name\":\"West US\",\"type\":\"Microsoft.ImportExport/locations\"},{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"1515 Port Industrial Parkway\",\"streetAddress2\":\"\",\"city\":\"Quincy\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98848\",\"countryOrRegion\":\"USA\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/westus2\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/westus2\",\"name\":\"West US 2\",\"type\":\"Microsoft.ImportExport/locations\"}]}" + } + }, + "Get-AzImportExportLocation+[NoContext]+Get+$GET+https://management.azure.com/providers/Microsoft.ImportExport/locations/eastus?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.ImportExport/locations/eastus?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "29" ], + "x-ms-client-request-id": [ "be72f6bf-4a60-4b57-81e9-59fa2b014d0c" ], + "CommandName": [ "Get-AzImportExportLocation" ], + "FullCommandName": [ "Get-AzImportExportLocation_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "17fcf702-f824-48b0-bb1d-4ae242a003e8" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11997" ], + "x-ms-correlation-request-id": [ "7b070e18-1bae-41b5-bac4-17cdd43dede4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101456Z:7b070e18-1bae-41b5-bac4-17cdd43dede4" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "480" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus\",\"name\":\"East US\",\"type\":\"Microsoft.ImportExport/locations\"}" + } + }, + "Get-AzImportExportLocation+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/providers/Microsoft.ImportExport/locations/eastus?api-version=2016-11-01+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/providers/Microsoft.ImportExport/locations/eastus?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "30" ], + "x-ms-client-request-id": [ "3f9014a5-88ae-4928-a29c-786d85200b2d" ], + "CommandName": [ "Get-AzImportExportLocation" ], + "FullCommandName": [ "Get-AzImportExportLocation_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "d35724c6-5a80-415f-903c-50c1ca161162" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-tenant-reads": [ "11996" ], + "x-ms-correlation-request-id": [ "75369fc4-b663-4a67-98f7-26720cb3c96f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101457Z:75369fc4-b663-4a67-98f7-26720cb3c96f" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:14:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "480" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\",\"supportedCarriers\":[\"Blue Dart\",\"DHL\",\"FedEx\",\"TNT\",\"UPS\"],\"alternateLocations\":[\"/providers/Microsoft.ImportExport/locations/eastus\"]},\"id\":\"/providers/Microsoft.ImportExport/locations/eastus\",\"name\":\"East US\",\"type\":\"Microsoft.ImportExport/locations\"}" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/Get-AzImportExportLocation.Tests.ps1 b/src/ImportExport/test/Get-AzImportExportLocation.Tests.ps1 new file mode 100644 index 000000000000..bf6ef76a7570 --- /dev/null +++ b/src/ImportExport/test/Get-AzImportExportLocation.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzImportExportLocation.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzImportExportLocation' { + It 'List' { + $location = Get-AzImportExportLocation + $location.Count | Should -BeGreaterOrEqual 1 + } + + It 'Get' { + $location = Get-AzImportExportLocation -Name $env.location + $location.Count | Should -Be 1 + } + + It 'GetViaIdentity' { + $Id = "/providers/Microsoft.ImportExport/locations/$($env.location)" + $location = Get-AzImportExportLocation -InputObject $Id + $location.Count | Should -Be 1 + } +} diff --git a/src/ImportExport/test/New-AzImportExport.Recording.json b/src/ImportExport/test/New-AzImportExport.Recording.json new file mode 100644 index 000000000000..2f92dc64d11f --- /dev/null +++ b/src/ImportExport/test/New-AzImportExport.Recording.json @@ -0,0 +1,36 @@ +{ + "New-AzImportExport+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/new-job?api-version=2016-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/new-job?api-version=2016-11-01", + "Content": "{\n \"properties\": {\n \"returnAddress\": {\n \"city\": \"Redmond\",\n \"countryOrRegion\": \"USA\",\n \"email\": \"test@contoso.com\",\n \"phone\": \"4250000000\",\n \"postalCode\": \"98008\",\n \"recipientName\": \"Some name\",\n \"stateOrProvince\": \"WA\",\n \"streetAddress1\": \"Street1\"\n },\n \"backupDriveManifest\": true,\n \"diagnosticsPath\": \"waimportexport\",\n \"driveList\": [\n {\n \"bitLockerKey\": \"238810-662376-448998-450120-652806-203390-606320-483076\",\n \"driveHeaderHash\": \"\",\n \"driveId\": \"9CA995BA\",\n \"manifestFile\": \"\\\\\\\\DriveManifest.xml\",\n \"manifestHash\": \"109B21108597EF36D5785F08303F3638\"\n },\n {\n \"bitLockerKey\": \"238810-662376-448998-450120-652806-203390-606320-483079\",\n \"driveId\": \"9CA995BX\",\n \"manifestFile\": \"\\\\\\\\DriveManifest2.xml\",\n \"manifestHash\": \"109B21108597EF36D5785F08303F3639\"\n }\n ],\n \"jobType\": \"Import\",\n \"storageAccountId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "1139" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "3e7d5acf-16d4-47fd-89f5-158cdbcacd91" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "x-ms-correlation-request-id": [ "0402e8ae-351b-44df-a090-e9342c081ca9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101502Z:0402e8ae-351b-44df-a090-e9342c081ca9" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1407" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BA\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"},{\"driveId\":\"9CA995BX\",\"manifestFile\":\"\\\\\\\\DriveManifest2.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3639\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/new-job\",\"name\":\"new-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"eastus\"}" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/New-AzImportExport.Tests.ps1 b/src/ImportExport/test/New-AzImportExport.Tests.ps1 new file mode 100644 index 000000000000..c853065ff31b --- /dev/null +++ b/src/ImportExport/test/New-AzImportExport.Tests.ps1 @@ -0,0 +1,24 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImportExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImportExport' { + It 'CreateExpanded' { + { + $jobName = "new-job" + $driveList = @( @{ DriveId = "9CA995BA"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }, + @{ DriveId = "9CA995BX"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483079"; ManifestFile = "\\DriveManifest2.xml"; ManifestHash = "109B21108597EF36D5785F08303F3639"; DriverHeaderHash = ""}) + $job = New-AzImportExport -Name $jobName -ResourceGroupName $env.resourceGroup -Location $env.location -StorageAccountId "/subscriptions/$($env.SubscriptionId)/resourcegroups/$($env.resourceGroup)/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList + } | Should -Not -Throw + $job.Name | Should -Be $jobName + } +} \ No newline at end of file diff --git a/src/ImportExport/test/New-AzImportExportDriveListObject.Tests.ps1 b/src/ImportExport/test/New-AzImportExportDriveListObject.Tests.ps1 new file mode 100644 index 000000000000..d7e95d462913 --- /dev/null +++ b/src/ImportExport/test/New-AzImportExportDriveListObject.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzImportExportDriveListObject.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzImportExportDriveListObject' { + It '__AllParameterSets' { + $driveList = New-AzImportExportDriveListObject -BitLockerKey "238810-662376-448998-450120-652806-203390-606320-483076" + $driveList.BitLockerKey | Should -Be 238810-662376-448998-450120-652806-203390-606320-483076 + } +} diff --git a/src/ImportExport/test/Remove-AzImportExport.Recording.json b/src/ImportExport/test/Remove-AzImportExport.Recording.json new file mode 100644 index 000000000000..63a3e6a80c78 --- /dev/null +++ b/src/ImportExport/test/Remove-AzImportExport.Recording.json @@ -0,0 +1,146 @@ +{ + "Remove-AzImportExport+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01", + "Content": "{\n \"properties\": {\n \"returnAddress\": {\n \"city\": \"Redmond\",\n \"countryOrRegion\": \"USA\",\n \"email\": \"test@contoso.com\",\n \"phone\": \"4250000000\",\n \"postalCode\": \"98008\",\n \"recipientName\": \"Some name\",\n \"stateOrProvince\": \"WA\",\n \"streetAddress1\": \"Street1\"\n },\n \"backupDriveManifest\": true,\n \"diagnosticsPath\": \"waimportexport\",\n \"driveList\": [\n {\n \"bitLockerKey\": \"238810-662376-448998-450120-652806-203390-606320-483076\",\n \"driveHeaderHash\": \"\",\n \"driveId\": \"9CA995BC\",\n \"manifestFile\": \"\\\\\\\\DriveManifest.xml\",\n \"manifestHash\": \"109B21108597EF36D5785F08303F3638\"\n }\n ],\n \"jobType\": \"Import\",\n \"storageAccountId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "899" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "6b4867f4-2e67-44f3-b2d0-fa888c0e2460" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "x-ms-correlation-request-id": [ "181064b3-89da-4644-abf3-d96c77b064c8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101507Z:181064b3-89da-4644-abf3-d96c77b064c8" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:06 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1288" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BC\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete\",\"name\":\"job-for-delete\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"eastus\"}" + } + }, + "Remove-AzImportExport+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "33" ], + "x-ms-client-request-id": [ "99c6abf1-6f70-4fc9-b7d5-63e5a58f37ad" ], + "CommandName": [ "Remove-AzImportExport" ], + "FullCommandName": [ "Remove-AzImportExport_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "e244a513-d0e5-46c1-a370-cc02ffcbe806" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-correlation-request-id": [ "da286506-08c4-4074-b211-748da8224b46" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101510Z:da286506-08c4-4074-b211-748da8224b46" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:09 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzImportExport+[NoContext]+DeleteViaIdentity+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01", + "Content": "{\n \"properties\": {\n \"returnAddress\": {\n \"city\": \"Redmond\",\n \"countryOrRegion\": \"USA\",\n \"email\": \"test@contoso.com\",\n \"phone\": \"4250000000\",\n \"postalCode\": \"98008\",\n \"recipientName\": \"Some name\",\n \"stateOrProvince\": \"WA\",\n \"streetAddress1\": \"Street1\"\n },\n \"backupDriveManifest\": true,\n \"diagnosticsPath\": \"waimportexport\",\n \"driveList\": [\n {\n \"bitLockerKey\": \"238810-662376-448998-450120-652806-203390-606320-483076\",\n \"driveHeaderHash\": \"\",\n \"driveId\": \"9CA995BD\",\n \"manifestFile\": \"\\\\\\\\DriveManifest.xml\",\n \"manifestHash\": \"109B21108597EF36D5785F08303F3638\"\n }\n ],\n \"jobType\": \"Import\",\n \"storageAccountId\": \"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "899" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "5bed6bdf-f2dd-49d2-bf1c-95a67bd677fb" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "x-ms-correlation-request-id": [ "7d8ba90b-875d-4f9b-83a9-f12e5b589d2c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101514Z:7d8ba90b-875d-4f9b-83a9-f12e5b589d2c" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1288" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BD\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete\",\"name\":\"job-for-delete\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"eastus\"}" + } + }, + "Remove-AzImportExport+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/job-for-delete?api-version=2016-11-01", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "35" ], + "x-ms-client-request-id": [ "6d2bfe6f-b075-4ec9-ae8f-4144f83b0bdf" ], + "CommandName": [ "Remove-AzImportExport" ], + "FullCommandName": [ "Remove-AzImportExport_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "7c5a8c02-cf0e-465e-8473-0d01e05ae17e" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-correlation-request-id": [ "4f3d0a1b-2315-4c69-9bd1-2186832c5fb2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101517Z:4f3d0a1b-2315-4c69-9bd1-2186832c5fb2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:16 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/Remove-AzImportExport.Tests.ps1 b/src/ImportExport/test/Remove-AzImportExport.Tests.ps1 new file mode 100644 index 000000000000..b613b6f0a3fd --- /dev/null +++ b/src/ImportExport/test/Remove-AzImportExport.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzImportExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzImportExport' { + It 'Delete' { + $jobName = "job-for-delete" + $driveList = @( @{ DriveId = "9CA995BC"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) + New-AzImportExport -Name $jobName -ResourceGroupName $env.resourceGroup -Location $env.location -StorageAccountId "/subscriptions/$($env.SubscriptionId)/resourcegroups/$($env.resourceGroup)/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList + { + Remove-AzImportExport -Name $jobName -ResourceGroupName $env.resourceGroup + } | Should -Not -Throw + } + + It 'DeleteViaIdentity' { + $jobName = "job-for-delete" + $driveList = @( @{ DriveId = "9CA995BD"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) + $job = New-AzImportExport -Name $jobName -ResourceGroupName $env.resourceGroup -Location $env.location -StorageAccountId "/subscriptions/$($env.SubscriptionId)/resourcegroups/$($env.resourceGroup)/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList + { + Remove-AzImportExport -InputObject $job + } | Should -Not -Throw + } +} diff --git a/src/ImportExport/test/Update-AzImportExport.Recording.json b/src/ImportExport/test/Update-AzImportExport.Recording.json new file mode 100644 index 000000000000..d2f64d7a90b3 --- /dev/null +++ b/src/ImportExport/test/Update-AzImportExport.Recording.json @@ -0,0 +1,70 @@ +{ + "Update-AzImportExport+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01", + "Content": "{\n \"properties\": {\n \"deliveryPackage\": {\n \"carrierName\": \"pwsh\",\n \"driveCount\": 0,\n \"trackingNumber\": \"pwsh20200000\"\n }\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "147" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "19a5194c-d69b-4925-976e-695c14ba1826" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "x-ms-correlation-request-id": [ "35c6f612-d0eb-4482-a20f-289cf22f46f1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101518Z:35c6f612-d0eb-4482-a20f-289cf22f46f1" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1365" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"deliveryPackage\":{\"carrierName\":\"pwsh\",\"trackingNumber\":\"pwsh20200000\",\"driveCount\":0},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":false,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BB\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}" + } + }, + "Update-AzImportExport+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job?api-version=2016-11-01", + "Content": "{\n \"properties\": {\n \"cancelRequested\": true\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "53" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-request-id": [ "af9fce0b-791e-4289-a0b5-c19cae828381" ], + "Server": [ "Microsoft-HTTPAPI/2.0" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "x-ms-correlation-request-id": [ "5b2a41c7-82a3-43e5-bcbd-1564f7f7bc54" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200428T101519Z:5b2a41c7-82a3-43e5-bcbd-1564f7f7bc54" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Tue, 28 Apr 2020 10:15:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1364" ], + "Content-Type": [ "application/json" ], + "Expires": [ "-1" ] + }, + "Content": "{\"properties\":{\"storageAccountId\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourcegroups/ImportExportTest/providers/Microsoft.Storage/storageAccounts/teststorageforimport\",\"jobType\":\"Import\",\"returnAddress\":{\"recipientName\":\"Some name\",\"streetAddress1\":\"Street1\",\"streetAddress2\":\"\",\"city\":\"Redmond\",\"stateOrProvince\":\"WA\",\"postalCode\":\"98008\",\"countryOrRegion\":\"USA\",\"phone\":\"4250000000\",\"email\":\"test@contoso.com\"},\"shippingInformation\":{\"recipientName\":\"Microsoft Azure Import/Export Service\",\"streetAddress1\":\"21625 Gresham Drive\",\"streetAddress2\":\"\",\"city\":\"Ashburn\",\"stateOrProvince\":\"VA\",\"postalCode\":\"20147\",\"countryOrRegion\":\"USA\",\"phone\":\"\"},\"deliveryPackage\":{\"carrierName\":\"pwsh\",\"trackingNumber\":\"pwsh20200000\",\"driveCount\":0},\"diagnosticsPath\":\"waimportexport\",\"logLevel\":\"Error\",\"backupDriveManifest\":true,\"cancelRequested\":true,\"state\":\"Creating\",\"driveList\":[{\"driveId\":\"9CA995BB\",\"manifestFile\":\"\\\\\\\\DriveManifest.xml\",\"manifestHash\":\"109B21108597EF36D5785F08303F3638\",\"driveHeaderHash\":\"\",\"state\":\"Specified\"}],\"provisioningState\":\"Succeeded\",\"encryptionKey\":{\"kekType\":\"MicrosoftManaged\"}},\"identity\":{\"type\":\"None\"},\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/ImportExportTest/providers/Microsoft.ImportExport/jobs/test-job\",\"name\":\"test-job\",\"type\":\"Microsoft.ImportExport/jobs\",\"location\":\"East US\"}" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/Update-AzImportExport.Tests.ps1 b/src/ImportExport/test/Update-AzImportExport.Tests.ps1 new file mode 100644 index 000000000000..adfffdc03a14 --- /dev/null +++ b/src/ImportExport/test/Update-AzImportExport.Tests.ps1 @@ -0,0 +1,28 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzImportExport.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzImportExport' { + It 'UpdateExpanded' { + $name = "pwsh" + $number = "pwsh20200000" + $job = Update-AzImportExport -Name $env.jobName -ResourceGroupName $env.resourceGroup -DeliveryPackageCarrierName $name -DeliveryPackageTrackingNumber $number + $job.DeliveryPackageCarrierName | Should -Be $name + $job.DeliveryPackageTrackingNumber | Should -Be $number + } + + It 'UpdateViaIdentityExpanded' { + $Id = "/subscriptions/$($env.SubscriptionId)/resourceGroups/$($env.resourceGroup)/providers/Microsoft.ImportExport/jobs/$($env.jobName)" + $job = Update-AzImportExport -InputObject $Id -CancelRequested + $job.CancelRequested | Should -Be True + } +} diff --git a/src/ImportExport/test/deployment-templates/storage-account/parameters.json b/src/ImportExport/test/deployment-templates/storage-account/parameters.json new file mode 100644 index 000000000000..7a4d8d58c600 --- /dev/null +++ b/src/ImportExport/test/deployment-templates/storage-account/parameters.json @@ -0,0 +1,5 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { } +} \ No newline at end of file diff --git a/src/ImportExport/test/deployment-templates/storage-account/template.json b/src/ImportExport/test/deployment-templates/storage-account/template.json new file mode 100644 index 000000000000..2bcbec26a43c --- /dev/null +++ b/src/ImportExport/test/deployment-templates/storage-account/template.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS", + "allowedValues": [ + "Standard_LRS", + "Standard_GRS", + "Standard_ZRS", + "Premium_LRS" + ], + "metadata": { + "description": "Storage Account type" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + } + }, + "variables": { + "storageAccountName": "teststorageforimport" + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2019-04-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageAccountType')]" + }, + "kind": "StorageV2", + "properties": {} + } + ], + "outputs": { + "storageAccountName": { + "type": "string", + "value": "[variables('storageAccountName')]" + } + } +} \ No newline at end of file diff --git a/src/ImportExport/test/env.json b/src/ImportExport/test/env.json new file mode 100644 index 000000000000..c8b8ea9f65d4 --- /dev/null +++ b/src/ImportExport/test/env.json @@ -0,0 +1,16 @@ +{ + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "location": "eastus", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "resourceGroup": "ImportExportTest", + "driveList": [ + { + "DriveId": "9CA995BB", + "DriveHeaderHash": "", + "ManifestFile": "\\\\DriveManifest.xml", + "ManifestHash": "109B21108597EF36D5785F08303F3638", + "BitLockerKey": "238810-662376-448998-450120-652806-203390-606320-483076" + } + ], + "jobName": "test-job" +} diff --git a/src/ImportExport/test/loadEnv.ps1 b/src/ImportExport/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/ImportExport/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/ImportExport/test/localEnv.json b/src/ImportExport/test/localEnv.json new file mode 100644 index 000000000000..b62aab2b3106 --- /dev/null +++ b/src/ImportExport/test/localEnv.json @@ -0,0 +1,16 @@ +{ + "driveList": [ + { + "BitLockerKey": "238810-662376-448998-450120-652806-203390-606320-483076", + "ManifestHash": "109B21108597EF36D5785F08303F3638", + "DriveId": "9CA995BB", + "DriveHeaderHash": "", + "ManifestFile": "\\\\DriveManifest.xml" + } + ], + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "jobName": "test-job", + "location": "eastus", + "resourceGroup": "ImportExportTest", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f" +} diff --git a/src/ImportExport/test/readme.md b/src/ImportExport/test/readme.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/ImportExport/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/ImportExport/test/utils.ps1 b/src/ImportExport/test/utils.ps1 new file mode 100644 index 000000000000..b6b520e190d2 --- /dev/null +++ b/src/ImportExport/test/utils.ps1 @@ -0,0 +1,50 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + + # Create the test group + write-host "start to create test group." + $resourceGroup = "ImportExportTest" + $location = "eastus" + $env.Add("resourceGroup", $resourceGroup) + $env.Add("location", $location) + New-AzResourceGroup -Name $resourceGroup -Location $location + + # Create the test storageaccount + write-host "Deploy StorageAccount template" + New-AzDeployment -Mode Incremental -TemplateFile .\test\deployment-templates\storage-account\template.json -TemplateParameterFile .\test\deployment-templates\storage-account\parameters.json -Name sa -ResourceGroupName $resourceGroup + + $jobName = "test-job" + $driveList = @( @{ DriveId = "9CA995BB"; BitLockerKey = "238810-662376-448998-450120-652806-203390-606320-483076"; ManifestFile = "\\DriveManifest.xml"; ManifestHash = "109B21108597EF36D5785F08303F3638"; DriveHeaderHash = "" }) + $env.Add("jobName", $jobName) + $env.Add("driveList", $driveList) + + write-host (Get-AzContext | Out-String) + + write-host "New a test import job" + New-AzImportExport -Name $jobName -ResourceGroupName $resourceGroup -Location $location -StorageAccountId "/subscriptions/$($env.SubscriptionId)/resourcegroups/$resourceGroup/providers/Microsoft.Storage/storageAccounts/teststorageforimport" -JobType Import -ReturnAddressRecipientName "Some name" -ReturnAddressStreetAddress1 "Street1" -ReturnAddressCity "Redmond" -ReturnAddressStateOrProvince "WA" -ReturnAddressPostalCode "98008" -ReturnAddressCountryOrRegion "USA" -ReturnAddressPhone "4250000000" -ReturnAddressEmail test@contoso.com -DiagnosticsPath "waimportexport" -BackupDriveManifest -DriveList $driveList + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing + # Removing resourcegroup will clean all the resources created for testing. + write-host "Clean resources you create for testing." + Remove-AzResourceGroup -Name $env.resourceGroup +} + From 6438df6c138954d8f759ea6151db519456f2e53e Mon Sep 17 00:00:00 2001 From: msJinLei Date: Mon, 25 May 2020 13:44:31 +0800 Subject: [PATCH 2/5] Initial version of Blockchain --- src/Blockchain/Az.BlockChain.format.ps1xml | 933 ++++ src/Blockchain/Az.BlockChain.psd1 | 24 + src/Blockchain/Az.BlockChain.psm1 | 109 + src/Blockchain/MSSharedLibKey.snk | Bin 0 -> 160 bytes src/Blockchain/build-module.ps1 | 153 + src/Blockchain/check-dependencies.ps1 | 62 + .../custom/Az.Blockchain.custom.psm1 | 17 + .../custom/New-AzBlockchainMember.ps1 | 205 + .../New-AzBlockchainTransactionNode.ps1 | 148 + .../custom/Update-AzBlockchainMember.ps1 | 158 + .../Update-AzBlockchainTransactionNode.ps1 | 145 + src/Blockchain/custom/readme.md | 41 + .../examples/Get-AzBlockchainConsortium.md | 8 + .../examples/Get-AzBlockchainMember.md | 50 + .../examples/Get-AzBlockchainMemberApiKey.md | 12 + .../Get-AzBlockchainMemberConsortiumMember.md | 11 + .../examples/Get-AzBlockchainSku.md | 7 + .../Get-AzBlockchainTransactionNode.md | 34 + .../Get-AzBlockchainTransactionNodeApiKey.md | 11 + .../examples/New-AzBlockchainMember.md | 13 + .../examples/New-AzBlockchainMemberApiKey.md | 27 + .../New-AzBlockchainTransactionNode.md | 12 + .../New-AzBlockchainTransactionNodeApiKey.md | 28 + .../examples/Remove-AzBlockchainMember.md | 17 + .../Remove-AzBlockchainTransactionNode.md | 16 + ...st-AzBlockchainLocationNameAvailability.md | 22 + .../examples/Update-AzBlockchainMember.md | 25 + .../Update-AzBlockchainTransactionNode.md | 25 + src/Blockchain/export-surface.ps1 | 40 + .../exports/Get-AzBlockchainConsortium.ps1 | 133 + .../exports/Get-AzBlockchainMember.ps1 | 195 + .../exports/Get-AzBlockchainMemberApiKey.ps1 | 144 + ...Get-AzBlockchainMemberConsortiumMember.ps1 | 143 + .../exports/Get-AzBlockchainSku.ps1 | 127 + .../Get-AzBlockchainTransactionNode.ps1 | 190 + .../Get-AzBlockchainTransactionNodeApiKey.ps1 | 150 + .../exports/New-AzBlockchainMember.ps1 | 242 ++ .../exports/New-AzBlockchainMemberApiKey.ps1 | 189 + .../New-AzBlockchainTransactionNode.ps1 | 191 + .../New-AzBlockchainTransactionNodeApiKey.ps1 | 195 + .../exports/ProxyCmdletDefinitions.ps1 | 2837 ++++++++++++ .../exports/Remove-AzBlockchainMember.ps1 | 186 + .../Remove-AzBlockchainTransactionNode.ps1 | 191 + ...t-AzBlockchainLocationNameAvailability.ps1 | 154 + .../exports/Update-AzBlockchainMember.ps1 | 207 + .../Update-AzBlockchainTransactionNode.ps1 | 200 + src/Blockchain/exports/readme.md | 20 + src/Blockchain/generate-help.ps1 | 73 + src/Blockchain/generate-info.json | 8 + src/Blockchain/generated/Module.cs | 158 + src/Blockchain/generated/api/Blockchain.cs | 3810 +++++++++++++++++ .../Api20180601Preview/ApiKey.PowerShell.cs | 135 + .../ApiKey.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/ApiKey.cs | 65 + .../Models/Api20180601Preview/ApiKey.json.cs | 105 + .../ApiKeyCollection.PowerShell.cs | 133 + .../ApiKeyCollection.TypeConverter.cs | 142 + .../Api20180601Preview/ApiKeyCollection.cs | 48 + .../ApiKeyCollection.json.cs | 111 + .../BlockchainMember.PowerShell.cs | 179 + .../BlockchainMember.TypeConverter.cs | 142 + .../Api20180601Preview/BlockchainMember.cs | 352 ++ .../BlockchainMember.json.cs | 107 + .../BlockchainMemberCollection.PowerShell.cs | 137 + ...lockchainMemberCollection.TypeConverter.cs | 142 + .../BlockchainMemberCollection.cs | 75 + .../BlockchainMemberCollection.json.cs | 113 + .../BlockchainMemberNodesSku.PowerShell.cs | 133 + .../BlockchainMemberNodesSku.TypeConverter.cs | 142 + .../BlockchainMemberNodesSku.cs | 46 + .../BlockchainMemberNodesSku.json.cs | 101 + .../BlockchainMemberProperties.PowerShell.cs | 161 + ...lockchainMemberProperties.TypeConverter.cs | 142 + .../BlockchainMemberProperties.cs | 294 ++ .../BlockchainMemberProperties.json.cs | 153 + ...kchainMemberPropertiesUpdate.PowerShell.cs | 137 + ...ainMemberPropertiesUpdate.TypeConverter.cs | 142 + .../BlockchainMemberPropertiesUpdate.cs | 73 + .../BlockchainMemberPropertiesUpdate.json.cs | 103 + .../BlockchainMemberUpdate.PowerShell.cs | 143 + .../BlockchainMemberUpdate.TypeConverter.cs | 142 + .../BlockchainMemberUpdate.cs | 108 + .../BlockchainMemberUpdate.json.cs | 105 + .../BlockchainMemberUpdateTags.PowerShell.cs | 137 + ...lockchainMemberUpdateTags.TypeConverter.cs | 142 + .../BlockchainMemberUpdateTags.cs | 32 + .../BlockchainMemberUpdateTags.dictionary.cs | 70 + .../BlockchainMemberUpdateTags.json.cs | 104 + .../Consortium.PowerShell.cs | 133 + .../Consortium.TypeConverter.cs | 142 + .../Models/Api20180601Preview/Consortium.cs | 63 + .../Api20180601Preview/Consortium.json.cs | 103 + .../ConsortiumCollection.PowerShell.cs | 133 + .../ConsortiumCollection.TypeConverter.cs | 142 + .../ConsortiumCollection.cs | 46 + .../ConsortiumCollection.json.cs | 109 + .../ConsortiumMember.PowerShell.cs | 143 + .../ConsortiumMember.TypeConverter.cs | 142 + .../Api20180601Preview/ConsortiumMember.cs | 148 + .../ConsortiumMember.json.cs | 113 + .../ConsortiumMemberCollection.PowerShell.cs | 135 + ...onsortiumMemberCollection.TypeConverter.cs | 142 + .../ConsortiumMemberCollection.cs | 73 + .../ConsortiumMemberCollection.json.cs | 111 + .../FirewallRule.PowerShell.cs | 135 + .../FirewallRule.TypeConverter.cs | 142 + .../Models/Api20180601Preview/FirewallRule.cs | 80 + .../Api20180601Preview/FirewallRule.json.cs | 105 + .../NameAvailability.PowerShell.cs | 137 + .../NameAvailability.TypeConverter.cs | 142 + .../Api20180601Preview/NameAvailability.cs | 82 + .../NameAvailability.json.cs | 107 + .../NameAvailabilityRequest.PowerShell.cs | 137 + .../NameAvailabilityRequest.TypeConverter.cs | 142 + .../NameAvailabilityRequest.cs | 65 + .../NameAvailabilityRequest.json.cs | 105 + .../OperationResult.PowerShell.cs | 137 + .../OperationResult.TypeConverter.cs | 142 + .../Api20180601Preview/OperationResult.cs | 82 + .../OperationResult.json.cs | 107 + .../Api20180601Preview/Resource.PowerShell.cs | 135 + .../Resource.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/Resource.cs | 89 + .../Api20180601Preview/Resource.json.cs | 114 + .../ResourceProviderOperation.PowerShell.cs | 147 + ...ResourceProviderOperation.TypeConverter.cs | 142 + .../ResourceProviderOperation.cs | 148 + .../ResourceProviderOperation.json.cs | 107 + ...eProviderOperationCollection.PowerShell.cs | 137 + ...oviderOperationCollection.TypeConverter.cs | 143 + .../ResourceProviderOperationCollection.cs | 75 + ...esourceProviderOperationCollection.json.cs | 114 + ...urceProviderOperationDisplay.PowerShell.cs | 141 + ...eProviderOperationDisplay.TypeConverter.cs | 142 + .../ResourceProviderOperationDisplay.cs | 99 + .../ResourceProviderOperationDisplay.json.cs | 109 + .../ResourceTypeSku.PowerShell.cs | 133 + .../ResourceTypeSku.TypeConverter.cs | 142 + .../Api20180601Preview/ResourceTypeSku.cs | 63 + .../ResourceTypeSku.json.cs | 111 + .../ResourceTypeSkuCollection.PowerShell.cs | 133 + ...ResourceTypeSkuCollection.TypeConverter.cs | 142 + .../ResourceTypeSkuCollection.cs | 46 + .../ResourceTypeSkuCollection.json.cs | 109 + .../Api20180601Preview/Sku.PowerShell.cs | 133 + .../Api20180601Preview/Sku.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/Sku.cs | 63 + .../api/Models/Api20180601Preview/Sku.json.cs | 103 + .../SkuSetting.PowerShell.cs | 137 + .../SkuSetting.TypeConverter.cs | 142 + .../Models/Api20180601Preview/SkuSetting.cs | 97 + .../Api20180601Preview/SkuSetting.json.cs | 123 + .../TrackedResource.PowerShell.cs | 139 + .../TrackedResource.TypeConverter.cs | 142 + .../Api20180601Preview/TrackedResource.cs | 109 + .../TrackedResource.json.cs | 105 + .../TrackedResourceTags.PowerShell.cs | 137 + .../TrackedResourceTags.TypeConverter.cs | 142 + .../Api20180601Preview/TrackedResourceTags.cs | 32 + .../TrackedResourceTags.dictionary.cs | 70 + .../TrackedResourceTags.json.cs | 104 + .../TransactionNode.PowerShell.cs | 153 + .../TransactionNode.TypeConverter.cs | 142 + .../Api20180601Preview/TransactionNode.cs | 196 + .../TransactionNode.json.cs | 107 + .../TransactionNodeCollection.PowerShell.cs | 137 + ...TransactionNodeCollection.TypeConverter.cs | 142 + .../TransactionNodeCollection.cs | 75 + .../TransactionNodeCollection.json.cs | 113 + .../TransactionNodeProperties.PowerShell.cs | 143 + ...TransactionNodeProperties.TypeConverter.cs | 142 + .../TransactionNodeProperties.cs | 143 + .../TransactionNodeProperties.json.cs | 131 + ...nsactionNodePropertiesUpdate.PowerShell.cs | 137 + ...ctionNodePropertiesUpdate.TypeConverter.cs | 142 + .../TransactionNodePropertiesUpdate.cs | 65 + .../TransactionNodePropertiesUpdate.json.cs | 113 + .../TransactionNodeUpdate.PowerShell.cs | 139 + .../TransactionNodeUpdate.TypeConverter.cs | 142 + .../TransactionNodeUpdate.cs | 71 + .../TransactionNodeUpdate.json.cs | 103 + .../Models/BlockchainIdentity.PowerShell.cs | 146 + .../BlockchainIdentity.TypeConverter.cs | 157 + .../api/Models/BlockchainIdentity.cs | 168 + .../api/Models/BlockchainIdentity.json.cs | 117 + ...kchainMemberProvisioningState.Completer.cs | 55 + ...inMemberProvisioningState.TypeConverter.cs | 59 + .../BlockchainMemberProvisioningState.cs | 111 + .../Support/BlockchainProtocol.Completer.cs | 47 + .../BlockchainProtocol.TypeConverter.cs | 59 + .../api/Support/BlockchainProtocol.cs | 101 + .../NameAvailabilityReason.Completer.cs | 43 + .../NameAvailabilityReason.TypeConverter.cs | 59 + .../api/Support/NameAvailabilityReason.cs | 99 + .../NodeProvisioningState.Completer.cs | 51 + .../NodeProvisioningState.TypeConverter.cs | 59 + .../api/Support/NodeProvisioningState.cs | 103 + .../cmdlets/GetAzBlockchainConsortium_List.cs | 337 ++ .../GetAzBlockchainMemberApiKey_List.cs | 354 ++ ...AzBlockchainMemberConsortiumMember_List.cs | 361 ++ .../cmdlets/GetAzBlockchainMember_Get.cs | 351 ++ .../GetAzBlockchainMember_GetViaIdentity.cs | 323 ++ .../cmdlets/GetAzBlockchainMember_List.cs | 347 ++ .../cmdlets/GetAzBlockchainMember_List1.cs | 330 ++ .../cmdlets/GetAzBlockchainOperation_List.cs | 307 ++ .../cmdlets/GetAzBlockchainSku_List.cs | 320 ++ ...tAzBlockchainTransactionNodeApiKey_List.cs | 368 ++ .../GetAzBlockchainTransactionNode_Get.cs | 365 ++ ...lockchainTransactionNode_GetViaIdentity.cs | 327 ++ .../GetAzBlockchainTransactionNode_List.cs | 361 ++ ...ockchainMemberApiKey_RegenerateExpanded.cs | 381 ++ ...berApiKey_RegenerateViaIdentityExpanded.cs | 357 ++ .../NewAzBlockchainMember_CreateExpanded.cs | 564 +++ ...ransactionNodeApiKey_RegenerateExpanded.cs | 395 ++ ...odeApiKey_RegenerateViaIdentityExpanded.cs | 362 ++ ...lockchainTransactionNode_CreateExpanded.cs | 476 ++ .../RemoveAzBlockchainMember_Delete.cs | 422 ++ ...oveAzBlockchainMember_DeleteViaIdentity.cs | 394 ++ ...emoveAzBlockchainTransactionNode_Delete.cs | 437 ++ ...kchainTransactionNode_DeleteViaIdentity.cs | 398 ++ ...nLocationNameAvailability_CheckExpanded.cs | 363 ++ ...UpdateAzBlockchainMember_UpdateExpanded.cs | 408 ++ ...ckchainMember_UpdateViaIdentityExpanded.cs | 383 ++ ...lockchainTransactionNode_UpdateExpanded.cs | 397 ++ ...ansactionNode_UpdateViaIdentityExpanded.cs | 362 ++ .../generated/runtime/AsyncCommandRuntime.cs | 828 ++++ src/Blockchain/generated/runtime/AsyncJob.cs | 270 ++ .../runtime/AsyncOperationResponse.cs | 177 + .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 99 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 53 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 159 + .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 125 + .../BuildTime/Cmdlets/ExportTestStub.cs | 137 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 53 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 121 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 177 + .../runtime/BuildTime/Models/PsHelpTypes.cs | 199 + .../BuildTime/Models/PsMarkdownTypes.cs | 291 ++ .../BuildTime/Models/PsProxyOutputs.cs | 513 +++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 499 +++ .../runtime/BuildTime/PsAttributes.cs | 114 + .../runtime/BuildTime/PsExtensions.cs | 160 + .../generated/runtime/BuildTime/PsHelpers.cs | 104 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 249 ++ .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 + .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + src/Blockchain/generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 36 + src/Blockchain/generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../generated/runtime/EventListener.cs | 247 ++ src/Blockchain/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + .../generated/runtime/Extensions.cs | 111 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + .../generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 21 + .../generated/runtime/IHeaderSerializable.cs | 14 + .../generated/runtime/ISendAsync.cs | 289 ++ .../generated/runtime/InfoAttribute.cs | 34 + .../generated/runtime/Iso/IsoDate.cs | 214 + src/Blockchain/generated/runtime/JsonType.cs | 18 + src/Blockchain/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 68 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 + .../generated/runtime/Nodes/JsonNode.cs | 250 ++ .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 + .../generated/runtime/Nodes/JsonString.cs | 42 + .../generated/runtime/Nodes/XBinary.cs | 40 + .../generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 + .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 + .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 254 ++ src/Blockchain/generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 ++ .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 16 + .../runtime/TypeConverterExtensions.cs | 190 + .../runtime/UndeclaredResponseException.cs | 104 + .../generated/runtime/Writers/JsonWriter.cs | 223 + src/Blockchain/generated/runtime/delegates.cs | 23 + src/Blockchain/help/Az.Blockchain.md | 61 + .../help/Get-AzBlockchainConsortium.md | 126 + src/Blockchain/help/Get-AzBlockchainMember.md | 201 + .../help/Get-AzBlockchainMemberApiKey.md | 146 + .../Get-AzBlockchainMemberConsortiumMember.md | 114 + src/Blockchain/help/Get-AzBlockchainSku.md | 79 + .../help/Get-AzBlockchainTransactionNode.md | 197 + .../Get-AzBlockchainTransactionNodeApiKey.md | 162 + src/Blockchain/help/New-AzBlockchainMember.md | 372 ++ .../help/New-AzBlockchainMemberApiKey.md | 231 + .../help/New-AzBlockchainTransactionNode.md | 248 ++ .../New-AzBlockchainTransactionNodeApiKey.md | 246 ++ .../help/Remove-AzBlockchainMember.md | 235 + .../Remove-AzBlockchainTransactionNode.md | 250 ++ ...st-AzBlockchainLocationNameAvailability.md | 170 + .../help/Update-AzBlockchainMember.md | 268 ++ .../Update-AzBlockchainTransactionNode.md | 250 ++ src/Blockchain/how-to.md | 58 + .../internal/Az.Blockchain.internal.psm1 | 38 + .../internal/Get-AzBlockchainOperation.ps1 | 121 + .../internal/New-AzBlockchainMember.ps1 | 242 ++ .../New-AzBlockchainTransactionNode.ps1 | 191 + .../internal/ProxyCmdletDefinitions.ps1 | 961 +++++ .../internal/Update-AzBlockchainMember.ps1 | 207 + .../Update-AzBlockchainTransactionNode.ps1 | 200 + src/Blockchain/internal/readme.md | 14 + src/Blockchain/pack-module.ps1 | 16 + src/Blockchain/readme.md | 121 + src/Blockchain/run-module.ps1 | 59 + src/Blockchain/test-module.ps1 | 68 + .../Get-AzBlockchainConsortium.Recording.json | 41 + .../test/Get-AzBlockchainConsortium.Tests.ps1 | 20 + .../Get-AzBlockchainMember.Recording.json | 197 + .../test/Get-AzBlockchainMember.Tests.ps1 | 37 + ...et-AzBlockchainMemberApiKey.Recording.json | 41 + .../Get-AzBlockchainMemberApiKey.Tests.ps1 | 19 + ...chainMemberConsortiumMember.Recording.json | 41 + ...BlockchainMemberConsortiumMember.Tests.ps1 | 19 + .../test/Get-AzBlockchainSku.Recording.json | 40 + .../test/Get-AzBlockchainSku.Tests.ps1 | 18 + ...AzBlockchainTransactionNode.Recording.json | 158 + .../Get-AzBlockchainTransactionNode.Tests.ps1 | 32 + ...kchainTransactionNodeApiKey.Recording.json | 41 + ...zBlockchainTransactionNodeApiKey.Tests.ps1 | 19 + .../New-AzBlockchainMember.Recording.json | 660 +++ .../test/New-AzBlockchainMember.Tests.ps1 | 23 + ...ew-AzBlockchainMemberApiKey.Recording.json | 187 + .../New-AzBlockchainMemberApiKey.Tests.ps1 | 32 + ...AzBlockchainTransactionNode.Recording.json | 582 +++ .../New-AzBlockchainTransactionNode.Tests.ps1 | 22 + ...kchainTransactionNodeApiKey.Recording.json | 187 + ...zBlockchainTransactionNodeApiKey.Tests.ps1 | 31 + .../Remove-AzBlockchainMember.Recording.json | 2325 ++++++++++ .../test/Remove-AzBlockchainMember.Tests.ps1 | 34 + ...AzBlockchainTransactionNode.Recording.json | 1406 ++++++ ...move-AzBlockchainTransactionNode.Tests.ps1 | 33 + ...ainLocationNameAvailability.Recording.json | 70 + ...ockchainLocationNameAvailability.Tests.ps1 | 22 + .../Update-AzBlockchainMember.Recording.json | 255 ++ .../test/Update-AzBlockchainMember.Tests.ps1 | 34 + ...AzBlockchainTransactionNode.Recording.json | 109 + ...date-AzBlockchainTransactionNode.Tests.ps1 | 30 + src/Blockchain/test/env.json | 17 + src/Blockchain/test/loadEnv.ps1 | 28 + src/Blockchain/test/readme.md | 17 + src/Blockchain/test/utils.ps1 | 57 + 409 files changed, 63314 insertions(+) create mode 100644 src/Blockchain/Az.BlockChain.format.ps1xml create mode 100644 src/Blockchain/Az.BlockChain.psd1 create mode 100644 src/Blockchain/Az.BlockChain.psm1 create mode 100644 src/Blockchain/MSSharedLibKey.snk create mode 100644 src/Blockchain/build-module.ps1 create mode 100644 src/Blockchain/check-dependencies.ps1 create mode 100644 src/Blockchain/custom/Az.Blockchain.custom.psm1 create mode 100644 src/Blockchain/custom/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/custom/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/custom/readme.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainConsortium.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainSku.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/examples/New-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/New-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/examples/New-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/examples/Remove-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md create mode 100644 src/Blockchain/examples/Update-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Update-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/export-surface.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainSku.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 create mode 100644 src/Blockchain/exports/ProxyCmdletDefinitions.ps1 create mode 100644 src/Blockchain/exports/Remove-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 create mode 100644 src/Blockchain/exports/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/readme.md create mode 100644 src/Blockchain/generate-help.ps1 create mode 100644 src/Blockchain/generate-info.json create mode 100644 src/Blockchain/generated/Module.cs create mode 100644 src/Blockchain/generated/api/Blockchain.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/runtime/AsyncCommandRuntime.cs create mode 100644 src/Blockchain/generated/runtime/AsyncJob.cs create mode 100644 src/Blockchain/generated/runtime/AsyncOperationResponse.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 src/Blockchain/generated/runtime/CmdInfoHandler.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/ConversionException.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonArray.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonNode.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonNumber.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonObject.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonString.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/XNodeArray.cs create mode 100644 src/Blockchain/generated/runtime/Debugging.cs create mode 100644 src/Blockchain/generated/runtime/DictionaryExtensions.cs create mode 100644 src/Blockchain/generated/runtime/EventData.cs create mode 100644 src/Blockchain/generated/runtime/EventDataExtensions.cs create mode 100644 src/Blockchain/generated/runtime/EventListener.cs create mode 100644 src/Blockchain/generated/runtime/Events.cs create mode 100644 src/Blockchain/generated/runtime/EventsExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Extensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Seperator.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/TypeDetails.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/XHelper.cs create mode 100644 src/Blockchain/generated/runtime/HttpPipeline.cs create mode 100644 src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 src/Blockchain/generated/runtime/IAssociativeArray.cs create mode 100644 src/Blockchain/generated/runtime/IHeaderSerializable.cs create mode 100644 src/Blockchain/generated/runtime/ISendAsync.cs create mode 100644 src/Blockchain/generated/runtime/InfoAttribute.cs create mode 100644 src/Blockchain/generated/runtime/Iso/IsoDate.cs create mode 100644 src/Blockchain/generated/runtime/JsonType.cs create mode 100644 src/Blockchain/generated/runtime/Method.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonMember.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonModel.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonModelCache.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XList.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonDate.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonNode.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonNumber.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonObject.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonString.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/XBinary.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/XNull.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonParser.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonToken.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Location.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 src/Blockchain/generated/runtime/Parser/TokenReader.cs create mode 100644 src/Blockchain/generated/runtime/PipelineMocking.cs create mode 100644 src/Blockchain/generated/runtime/Response.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 src/Blockchain/generated/runtime/SerializationMode.cs create mode 100644 src/Blockchain/generated/runtime/TypeConverterExtensions.cs create mode 100644 src/Blockchain/generated/runtime/UndeclaredResponseException.cs create mode 100644 src/Blockchain/generated/runtime/Writers/JsonWriter.cs create mode 100644 src/Blockchain/generated/runtime/delegates.cs create mode 100644 src/Blockchain/help/Az.Blockchain.md create mode 100644 src/Blockchain/help/Get-AzBlockchainConsortium.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md create mode 100644 src/Blockchain/help/Get-AzBlockchainSku.md create mode 100644 src/Blockchain/help/Get-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/help/New-AzBlockchainMember.md create mode 100644 src/Blockchain/help/New-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/help/New-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/help/Remove-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Remove-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md create mode 100644 src/Blockchain/help/Update-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Update-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/how-to.md create mode 100644 src/Blockchain/internal/Az.Blockchain.internal.psm1 create mode 100644 src/Blockchain/internal/Get-AzBlockchainOperation.ps1 create mode 100644 src/Blockchain/internal/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/internal/ProxyCmdletDefinitions.ps1 create mode 100644 src/Blockchain/internal/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/internal/readme.md create mode 100644 src/Blockchain/pack-module.ps1 create mode 100644 src/Blockchain/readme.md create mode 100644 src/Blockchain/run-module.ps1 create mode 100644 src/Blockchain/test-module.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainSku.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/Remove-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json create mode 100644 src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 create mode 100644 src/Blockchain/test/Update-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/env.json create mode 100644 src/Blockchain/test/loadEnv.ps1 create mode 100644 src/Blockchain/test/readme.md create mode 100644 src/Blockchain/test/utils.ps1 diff --git a/src/Blockchain/Az.BlockChain.format.ps1xml b/src/Blockchain/Az.BlockChain.format.ps1xml new file mode 100644 index 000000000000..976f63ced768 --- /dev/null +++ b/src/Blockchain/Az.BlockChain.format.ps1xml @@ -0,0 +1,933 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.BlockchainIdentity + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.BlockchainIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + + BlockchainMemberName + + + Location + + + OperationId + + + ResourceGroupName + + + SubscriptionId + + + TransactionNodeName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey + + + + + + + + + + + + + + + KeyName + + + Value + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember + + + + + + + + + + + + + + + + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku + + + + + + + + + + + + Capacity + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Consortium + + + ConsortiumManagementAccountAddress + + + ConsortiumManagementAccountPassword + + + ConsortiumMemberDisplayName + + + ConsortiumRole + + + Dns + + + Password + + + Protocol + + + ProvisioningState + + + PublicKey + + + RootContractAddress + + + UserName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate + + + + + + + + + + + + + + + Password + + + ConsortiumManagementAccountPassword + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium + + + + + + + + + + + + + + + Name + + + Protocol + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DateModified + + + DisplayName + + + JoinDate + + + Name + + + Role + + + Status + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule + + + + + + + + + + + + + + + + + + EndIPAddress + + + RuleName + + + StartIPAddress + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability + + + + + + + + + + + + + + + + + + Message + + + NameAvailable + + + Reason + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult + + + + + + + + + + + + + + + + + + EndTime + + + Name + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation + + + + + + + + + + + + + + + + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku + + + + + + + + + + + + + + + Name + + + Tier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + RequiredFeature + + + Tier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource + + + + + + + + + + + + + + + + + + Name + + + Type + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode + + + + + + + + + + + + + + + + + + Name + + + Type + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties + + + + + + + + + + + + + + + + + + + + + + + + Dns + + + Password + + + ProvisioningState + + + PublicKey + + + UserName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate + + + + + + + + + + + + Password + + + + + + + + \ No newline at end of file diff --git a/src/Blockchain/Az.BlockChain.psd1 b/src/Blockchain/Az.BlockChain.psd1 new file mode 100644 index 000000000000..7813ba0ae211 --- /dev/null +++ b/src/Blockchain/Az.BlockChain.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = 'ae1a09bf-916c-480c-a1bb-bace1453a91e' + RootModule = './Az.Blockchain.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: Blockchain cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.Blockchain.private.dll' + FormatsToProcess = './Az.Blockchain.format.ps1xml' + FunctionsToExport = 'Get-AzBlockchainConsortium', 'Get-AzBlockchainMember', 'Get-AzBlockchainMemberApiKey', 'Get-AzBlockchainMemberConsortiumMember', 'Get-AzBlockchainSku', 'Get-AzBlockchainTransactionNode', 'Get-AzBlockchainTransactionNodeApiKey', 'New-AzBlockchainMember', 'New-AzBlockchainMemberApiKey', 'New-AzBlockchainTransactionNode', 'New-AzBlockchainTransactionNodeApiKey', 'Remove-AzBlockchainMember', 'Remove-AzBlockchainTransactionNode', 'Test-AzBlockchainLocationNameAvailability', 'Update-AzBlockchainMember', 'Update-AzBlockchainTransactionNode', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Blockchain' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/Blockchain/Az.BlockChain.psm1 b/src/Blockchain/Az.BlockChain.psm1 new file mode 100644 index 000000000000..e6650cff834c --- /dev/null +++ b/src/Blockchain/Az.BlockChain.psm1 @@ -0,0 +1,109 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # + # Copyright Microsoft Corporation + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # http://www.apache.org/licenses/LICENSE-2.0 + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Blockchain.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.Blockchain.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/Blockchain/MSSharedLibKey.snk b/src/Blockchain/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ: Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $null = $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $null = $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') + $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) + } + if ($PSBoundParameters.ContainsKey('Sku')) { + $PSBoundParameters.Add('SkuName', $PSBoundParameters['Sku']) + $null = $PSBoundParameters.Remove('Sku') + } + Az.Blockchain.internal\New-AzBlockchainMember @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..b0fef07d39d5 --- /dev/null +++ b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,148 @@ +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + + + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + Az.Blockchain.internal\New-AzBlockchainTransactionNode @PSBoundParameters + } catch { + throw + } +} + +} diff --git a/src/Blockchain/custom/Update-AzBlockchainMember.ps1 b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..63d29ab41e69 --- /dev/null +++ b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 @@ -0,0 +1,158 @@ +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') + $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) + } + Az.Blockchain.internal\Update-AzBlockchainMember @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..50dcb18f7493 --- /dev/null +++ b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,145 @@ +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + Az.Blockchain.internal\Update-AzBlockchainTransactionNode @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/readme.md b/src/Blockchain/custom/readme.md new file mode 100644 index 000000000000..e3cf700a8043 --- /dev/null +++ b/src/Blockchain/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.Blockchain` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.Blockchain.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.Blockchain` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.Blockchain.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.Blockchain.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.Blockchain`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Blockchain`. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Blockchain`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/Blockchain/examples/Get-AzBlockchainConsortium.md b/src/Blockchain/examples/Get-AzBlockchainConsortium.md new file mode 100644 index 000000000000..d7f6452c7c24 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainConsortium.md @@ -0,0 +1,8 @@ +### Example 1: Get Blockchain consortiums. +```powershell +PS C:\> Get-AzBlockchainConsortium -Location eastus + +``` + +This command lists the consortiums under a subscription for a specific location. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMember.md b/src/Blockchain/examples/Get-AzBlockchainMember.md new file mode 100644 index 000000000000..bb3b455210f2 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMember.md @@ -0,0 +1,50 @@ +### Example 1: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a subscription. + +### Example 2: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a resource group. + + +### Example 3: Get a blockchain member +```powershell +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +### Example 4: Get a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName lucas-blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md b/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..e9fd70ada136 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md @@ -0,0 +1,12 @@ +### Example 1: List blockchain Api keys +```powershell +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command lists Api keys for a blockchain member. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md b/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md new file mode 100644 index 000000000000..4ba3e6554bec --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md @@ -0,0 +1,11 @@ +### Example 1: Lists the consortium members for a blockchain member. +```powershell +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb +``` + +This command lists the consortium members for a blockchain member. + diff --git a/src/Blockchain/examples/Get-AzBlockchainSku.md b/src/Blockchain/examples/Get-AzBlockchainSku.md new file mode 100644 index 000000000000..697b29a8f170 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainSku.md @@ -0,0 +1,7 @@ +### Example 1: List SKU for a subscription +```powershell +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + +``` + +This command lists SKU for a subscription. diff --git a/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..6efceb12588f --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md @@ -0,0 +1,34 @@ +### Example 1: List transaction nodes for a blockchain member +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command lists transaction nodes for a blockchain member. + +### Example 2: Get a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +### Example 3: Get a transaction node +```powershell +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + diff --git a/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..60bdc4a1ac5a --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,11 @@ +### Example 1: List Api keys for a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command lists Api keys for a transaction node. diff --git a/src/Blockchain/examples/New-AzBlockchainMember.md b/src/Blockchain/examples/New-AzBlockchainMember.md new file mode 100644 index 000000000000..8670242f2deb --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainMember.md @@ -0,0 +1,13 @@ +### Example 1: Create a new blockchain member +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command creates a new blockchain member. + diff --git a/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md b/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..732fafe41d99 --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md @@ -0,0 +1,27 @@ +### Example 1: Regenerate Api keys for a blockchain member +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member. + +### Example 1: Regenerate Api keys for a blockchain member + +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member. diff --git a/src/Blockchain/examples/New-AzBlockchainTransactionNode.md b/src/Blockchain/examples/New-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..e5f8428a3c1c --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainTransactionNode.md @@ -0,0 +1,12 @@ +### Example 1: Create a blockchain transaction node +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command creates a blockchain transaction node. + diff --git a/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..c8341948dc5c --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,28 @@ +### Example 1: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node. + +### Example 2: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node. + + diff --git a/src/Blockchain/examples/Remove-AzBlockchainMember.md b/src/Blockchain/examples/Remove-AzBlockchainMember.md new file mode 100644 index 000000000000..6eb61c9a0e8c --- /dev/null +++ b/src/Blockchain/examples/Remove-AzBlockchainMember.md @@ -0,0 +1,17 @@ +### Example 1: Remove a blockchain member +```powershell +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +``` + +This command removes a blockchain member. + +### Example 2: Remove a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + +``` + +This command removes a blockchain member. + diff --git a/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..8e98f3b07c0d --- /dev/null +++ b/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md @@ -0,0 +1,16 @@ +### Example 1: Remove a transaction node +```powershell +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +``` + +This command removes a transaction node. + +### Example 2: Remove a transaction node +```powershell +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node +``` + +This command removes a transaction node. + diff --git a/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md b/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md new file mode 100644 index 000000000000..59b334286c9e --- /dev/null +++ b/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md @@ -0,0 +1,22 @@ +### Example 1: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +``` + +The command checks whether a resource name is available. + +### Example 2: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid +``` + +The command checks whether a resource name is available. + diff --git a/src/Blockchain/examples/Update-AzBlockchainMember.md b/src/Blockchain/examples/Update-AzBlockchainMember.md new file mode 100644 index 000000000000..809e71a5cf1c --- /dev/null +++ b/src/Blockchain/examples/Update-AzBlockchainMember.md @@ -0,0 +1,25 @@ +### Example 1: Update a blockchain member +```powershell +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +### Example 2: Update a blockchain member +```powershell +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + diff --git a/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..784d6f5079b3 --- /dev/null +++ b/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md @@ -0,0 +1,25 @@ +### Example 1: Update a transcation node +```powershell +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +### Example 2: Update a transcation node +```powershell +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + diff --git a/src/Blockchain/export-surface.ps1 b/src/Blockchain/export-surface.ps1 new file mode 100644 index 000000000000..8c6a036c19df --- /dev/null +++ b/src/Blockchain/export-surface.ps1 @@ -0,0 +1,40 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Blockchain.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.Blockchain' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 b/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 new file mode 100644 index 000000000000..0902208bc96b --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 @@ -0,0 +1,133 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available consortiums for a subscription. +.Description +Lists the available consortiums for a subscription. +.Example +PS C:\> Get-AzBlockchainConsortium -Location eastus + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +#> +function Get-AzBlockchainConsortium { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainConsortium_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMember.ps1 b/src/Blockchain/exports/Get-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..6b6c2634a5a8 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMember.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get details about a blockchain member. +.Description +Get details about a blockchain member. +.Example +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName lucas-blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +#> +function Get-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainMember_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainMember_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainMember_List'; + List1 = 'Az.Blockchain.private\Get-AzBlockchainMember_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 b/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 new file mode 100644 index 000000000000..4c946ce20d97 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 @@ -0,0 +1,144 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the API keys for a blockchain member. +.Description +Lists the API keys for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +#> +function Get-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 b/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 new file mode 100644 index 000000000000..7b74092afdce --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 @@ -0,0 +1,143 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the consortium members for a blockchain member. +.Description +Lists the consortium members for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +#> +function Get-AzBlockchainMemberConsortiumMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberConsortiumMember_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainSku.ps1 b/src/Blockchain/exports/Get-AzBlockchainSku.ps1 new file mode 100644 index 000000000000..1bbdd98809c7 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainSku.ps1 @@ -0,0 +1,127 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the Skus of the resource type. +.Description +Lists the Skus of the resource type. +.Example +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +#> +function Get-AzBlockchainSku { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainSku_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..03774800eb87 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,190 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of the transaction node. +.Description +Get the details of the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +#> +function Get-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 b/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 new file mode 100644 index 000000000000..88da6377bdef --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 @@ -0,0 +1,150 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List the API keys for the transaction node. +.Description +List the API keys for the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +#> +function Get-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNodeApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainMember.ps1 b/src/Blockchain/exports/New-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..a1d33a30219f --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainMember.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainMember'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 b/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 new file mode 100644 index 000000000000..b92a151cc2cf --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for a blockchain member. +.Description +Regenerate the API keys for a blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +#> +function New-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..9b3e44f7262f --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainTransactionNode'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 b/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 new file mode 100644 index 000000000000..207b1c109153 --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for the blockchain member. +.Description +Regenerate the API keys for the blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +#> +function New-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 b/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..980ebe095b2e --- /dev/null +++ b/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,2837 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available consortiums for a subscription. +.Description +Lists the available consortiums for a subscription. +.Example +PS C:\> Get-AzBlockchainConsortium -Location eastus + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +#> +function Get-AzBlockchainConsortium { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainConsortium_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the API keys for a blockchain member. +.Description +Lists the API keys for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +#> +function Get-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the consortium members for a blockchain member. +.Description +Lists the consortium members for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +#> +function Get-AzBlockchainMemberConsortiumMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberConsortiumMember_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get details about a blockchain member. +.Description +Get details about a blockchain member. +.Example +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName lucas-blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +#> +function Get-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainMember_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainMember_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainMember_List'; + List1 = 'Az.Blockchain.private\Get-AzBlockchainMember_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the Skus of the resource type. +.Description +Lists the Skus of the resource type. +.Example +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +#> +function Get-AzBlockchainSku { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainSku_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List the API keys for the transaction node. +.Description +List the API keys for the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +#> +function Get-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNodeApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of the transaction node. +.Description +Get the details of the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +#> +function Get-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for a blockchain member. +.Description +Regenerate the API keys for a blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +#> +function New-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for the blockchain member. +.Description +Regenerate the API keys for the blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +#> +function New-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a blockchain member. +.Description +Delete a blockchain member. +.Example +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +.Example +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +#> +function Remove-AzBlockchainMember { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainMember_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainMember_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete the transaction node. +.Description +Delete the transaction node. +.Example +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +.Example +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +#> +function Remove-AzBlockchainTransactionNode { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +To check whether a resource name is available. +.Description +To check whether a resource name is available. +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +#> +function Test-AzBlockchainLocationNameAvailability { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the name to check. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the type of the resource to check. + ${Type}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CheckExpanded = 'Az.Blockchain.private\Test-AzBlockchainLocationNameAvailability_CheckExpanded'; + } + if (('CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainMember'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainTransactionNode'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 b/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..47f06611c814 --- /dev/null +++ b/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 @@ -0,0 +1,186 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a blockchain member. +.Description +Delete a blockchain member. +.Example +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +.Example +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +#> +function Remove-AzBlockchainMember { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainMember_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainMember_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..2994c8f19642 --- /dev/null +++ b/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete the transaction node. +.Description +Delete the transaction node. +.Example +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +.Example +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +#> +function Remove-AzBlockchainTransactionNode { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 b/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 new file mode 100644 index 000000000000..8f143cebf60f --- /dev/null +++ b/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 @@ -0,0 +1,154 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +To check whether a resource name is available. +.Description +To check whether a resource name is available. +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +#> +function Test-AzBlockchainLocationNameAvailability { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the name to check. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the type of the resource to check. + ${Type}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CheckExpanded = 'Az.Blockchain.private\Test-AzBlockchainLocationNameAvailability_CheckExpanded'; + } + if (('CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Update-AzBlockchainMember.ps1 b/src/Blockchain/exports/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..c3e00c474cdb --- /dev/null +++ b/src/Blockchain/exports/Update-AzBlockchainMember.ps1 @@ -0,0 +1,207 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..4c6069f5a942 --- /dev/null +++ b/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/readme.md b/src/Blockchain/exports/readme.md new file mode 100644 index 000000000000..7f1c2e1b9a45 --- /dev/null +++ b/src/Blockchain/exports/readme.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.Blockchain`. No other cmdlets in this repository are directly exported. What that means is the `Az.Blockchain` module will run [Export-ModuleMember](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.Blockchain.private.dll`) and from the `..\custom\Az.Blockchain.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [readme.md](..\internal/readme.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.Blockchain.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/Blockchain/generate-help.ps1 b/src/Blockchain/generate-help.ps1 new file mode 100644 index 000000000000..bee64e686378 --- /dev/null +++ b/src/Blockchain/generate-help.ps1 @@ -0,0 +1,73 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Blockchain.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/generate-info.json b/src/Blockchain/generate-info.json new file mode 100644 index 000000000000..aa5b66e8a86a --- /dev/null +++ b/src/Blockchain/generate-info.json @@ -0,0 +1,8 @@ +{ + "node": "v10.16.0", + "autorest_remodeler": "2.1.27", + "swagger_commit": "48457dbed80bdd79662b3c010e5f20fe378451e3", + "autorest": "3.0.6187", + "autorest_powershell": "2.1.384", + "autorest_core": "3.0.6282" +} diff --git a/src/Blockchain/generated/Module.cs b/src/Blockchain/generated/Module.cs new file mode 100644 index 000000000000..a815952f6166 --- /dev/null +++ b/src/Blockchain/generated/Module.cs @@ -0,0 +1,158 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline _pipelineWithProxy; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module()); + + /// The Name of this module + public string Name => @"Az.Blockchain"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.Blockchain"; + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + /// constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; + _handler.UseProxy = proxy != null; + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Blockchain.cs b/src/Blockchain/generated/api/Blockchain.cs new file mode 100644 index 000000000000..573c37a508d5 --- /dev/null +++ b/src/Blockchain/generated/api/Blockchain.cs @@ -0,0 +1,3810 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Low-level API implementation for the Blockchain service. + /// + public partial class Blockchain + { + + /// Get Async operation result. + /// Location name. + /// Operation Id. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet(string location, string operationId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/blockchainMemberOperationResults/" + + global::System.Uri.EscapeDataString(operationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMemberOperationResultsGet_Call(request,onOk,onNoContent,eventListener,sender); + } + } + + /// Get Async operation result. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)/blockchainMemberOperationResults/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var operationId = _match.Groups["operationId"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/blockchainMemberOperationResults/" + + operationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMemberOperationResultsGet_Call(request,onOk,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Location name. + /// Operation Id. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet_Validate(string location, string operationId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Create a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create a blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersCreate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Create a blockchain member. + /// + /// Payload to create a blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create a blockchain member. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersCreate_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete a blockchain member. + /// Blockchain member name + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersDelete(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Delete a blockchain member. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersDelete_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Get details about a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersGet(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get details about a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersGet_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the blockchain members for a resource group. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the blockchain members for a subscription. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListAll_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the blockchain members for a subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListAll_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists the API keys for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the API keys for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListApiKeysViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the consortium members for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/consortiumMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListConsortiumMembers_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the consortium members for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/consortiumMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/consortiumMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListConsortiumMembers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the blockchain members for a resource group. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Regenerate the API keys for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerate + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Regenerate the API keys for a blockchain member. + /// + /// api key to be regenerate + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeysViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerate + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Update a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to update the blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersUpdate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Update a blockchain member. + /// + /// Payload to update the blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to update the blockchain member. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersUpdate_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// To check whether a resource name is available. + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// Name availability request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsCheckNameAvailability(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsCheckNameAvailability_Call(request,onOk,eventListener,sender); + } + } + + /// To check whether a resource name is available. + /// + /// Name availability request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsCheckNameAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/checkNameAvailability'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsCheckNameAvailability_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsCheckNameAvailability_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// Name availability request payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsCheckNameAvailability_Validate(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Lists the available consortiums for a subscription. + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsListConsortiums(string location, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/listConsortiums" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsListConsortiums_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available consortiums for a subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsListConsortiumsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/listConsortiums'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/listConsortiums" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsListConsortiums_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsListConsortiums_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsListConsortiums_Validate(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.Blockchain/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Blockchain/operations$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Blockchain/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.Blockchain/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// Lists the Skus of the resource type. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SkusList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/skus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SkusList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the Skus of the resource type. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SkusListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/skus$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/skus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SkusList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SkusList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SkusList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Create or update the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesCreate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Create or update the transaction node. + /// + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesCreate_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesDelete(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Delete the transaction node. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesDelete_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Get the details of the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesGet(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get the details of the transaction node. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesGet_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the transaction nodes for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesList(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesList_Call(request,onOk,eventListener,sender); + } + } + + /// List the API keys for the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListApiKeys(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// List the API keys for the transaction node. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListApiKeysViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesListApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesListApiKeys_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the transaction nodes for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesList_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Regenerate the API keys for the blockchain member. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerated + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Regenerate the API keys for the blockchain member. + /// + /// api key to be regenerated + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeysViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerated + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Update the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesUpdate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Update the transaction node. + /// + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesUpdate_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs new file mode 100644 index 000000000000..5ea5b01e4aac --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ApiKeyTypeConverter))] + public partial class ApiKey + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiKey(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName = (string) content.GetValueForProperty("KeyName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value = (string) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiKey(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName = (string) content.GetValueForProperty("KeyName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value = (string) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiKey(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiKey(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// API key payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ApiKeyTypeConverter))] + public partial interface IApiKey + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs new file mode 100644 index 000000000000..29b7a42a6408 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiKeyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiKey.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiKey.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiKey.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs new file mode 100644 index 000000000000..ca9a35d700bf --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + public partial class ApiKey : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal + { + + /// Backing field for property. + private string _keyName; + + /// Gets or sets the API key name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string KeyName { get => this._keyName; set => this._keyName = value; } + + /// Backing field for property. + private string _value; + + /// Gets or sets the API key value. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ApiKey() + { + + } + } + /// API key payload which is exposed in the request/response of the resource provider. + public partial interface IApiKey : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the API key name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + string KeyName { get; set; } + /// Gets or sets the API key value. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + string Value { get; set; } + + } + /// API key payload which is exposed in the request/response of the resource provider. + internal partial interface IApiKeyInternal + + { + /// Gets or sets the API key name. + string KeyName { get; set; } + /// Gets or sets the API key value. + string Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs new file mode 100644 index 000000000000..d78f156bcffd --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + public partial class ApiKey + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ApiKey(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_keyName = If( json?.PropertyT("keyName"), out var __jsonKeyName) ? (string)__jsonKeyName : (string)KeyName;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? (string)__jsonValue : (string)Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ApiKey(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._keyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._keyName.ToString()) : null, "keyName" ,container.Add ); + AddIf( null != (((object)this._value)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._value.ToString()) : null, "value" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs new file mode 100644 index 000000000000..6b2d9987baf0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ApiKeyCollectionTypeConverter))] + public partial class ApiKeyCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiKeyCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[]) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiKeyCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[]) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiKeyCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiKeyCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ApiKeyCollectionTypeConverter))] + public partial interface IApiKeyCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs new file mode 100644 index 000000000000..f7db25616147 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiKeyCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiKeyCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiKeyCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiKeyCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs new file mode 100644 index 000000000000..4f2aa8047e61 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs @@ -0,0 +1,48 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + public partial class ApiKeyCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] _key; + + /// Gets or sets the collection of API key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get => this._key; set => this._key = value; } + + /// Creates an new instance. + public ApiKeyCollection() + { + + } + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + public partial interface IApiKeyCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of API key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of API key.", + SerializedName = @"keys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get; set; } + + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + internal partial interface IApiKeyCollectionInternal + + { + /// Gets or sets the collection of API key. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs new file mode 100644 index 000000000000..54897e1f4927 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + public partial class ApiKeyCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ApiKeyCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_key = If( json?.PropertyT("keys"), out var __jsonKeys) ? If( __jsonKeys as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey.FromJson(__u) )) ))() : null : Key;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ApiKeyCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._key) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._key ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("keys",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs new file mode 100644 index 000000000000..80567e76a101 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs @@ -0,0 +1,179 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberTypeConverter))] + public partial class BlockchainMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier = (string) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier = (string) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberTypeConverter))] + public partial interface IBlockchainMember + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs new file mode 100644 index 000000000000..d0807d213157 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs new file mode 100644 index 000000000000..0e0c0415d863 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs @@ -0,0 +1,352 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource(); + + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Consortium { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Consortium; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Consortium = value; } + + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress; } + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountPassword = value; } + + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumMemberDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumMemberDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumMemberDisplayName = value; } + + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumRole { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumRole; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumRole = value; } + + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns; } + + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).FirewallRule = value; } + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id; } + + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Location = value; } + + /// Internal Acessors for ConsortiumManagementAccountAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ConsortiumManagementAccountAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey = value; } + + /// Internal Acessors for RootContractAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.RootContractAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress = value; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku()); set { {_sku = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName = value; } + + /// Internal Acessors for ValidatorNodesSku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ValidatorNodesSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodesSku; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodesSku = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name; } + + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties _property; + + /// Gets or sets the blockchain member properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties()); set => this._property = value; } + + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Protocol; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Protocol = value; } + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState; } + + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey; } + + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string RootContractAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku _sku; + + /// Gets or sets the blockchain member Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku()); set => this._sku = value; } + + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Name = value; } + + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string SkuTier { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Tier; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Tier = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Tag = value; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type; } + + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName; } + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public int? ValidatorNodeSkuCapacity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodeSkuCapacity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodeSkuCapacity = value; } + + /// Creates an new instance. + public BlockchainMember() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource + { + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + string Consortium { get; set; } + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the managed consortium management account address.", + SerializedName = @"consortiumManagementAccountAddress", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountAddress { get; } + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the dns endpoint of the blockchain member.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; } + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the public key of the blockchain member (default transaction node).", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the Ethereum root contract address of the blockchain.", + SerializedName = @"rootContractAddress", + PossibleTypes = new [] { typeof(string) })] + string RootContractAddress { get; } + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string SkuName { get; set; } + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string SkuTier { get; set; } + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the auth user name of the blockchain member.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? ValidatorNodeSkuCapacity { get; set; } + + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal + { + /// Gets or sets the consortium for the blockchain member. + string Consortium { get; set; } + /// Gets the managed consortium management account address. + string ConsortiumManagementAccountAddress { get; set; } + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + string Dns { get; set; } + /// Gets or sets firewall rules + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + string Password { get; set; } + /// Gets or sets the blockchain member properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Property { get; set; } + /// Gets or sets the blockchain protocol. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; set; } + /// Gets the public key of the blockchain member (default transaction node). + string PublicKey { get; set; } + /// Gets the Ethereum root contract address of the blockchain. + string RootContractAddress { get; set; } + /// Gets or sets the blockchain member Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Sku { get; set; } + /// Gets or sets Sku name + string SkuName { get; set; } + /// Gets or sets Sku tier + string SkuTier { get; set; } + /// Gets the auth user name of the blockchain member. + string UserName { get; set; } + /// Gets or sets the nodes capacity. + int? ValidatorNodeSkuCapacity { get; set; } + /// Gets or sets the blockchain validator nodes Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs new file mode 100644 index 000000000000..efe0dd3588ee --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMember(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties.FromJson(__jsonProperties) : Property;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku.FromJson(__jsonSku) : Sku;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMember(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs new file mode 100644 index 000000000000..ee3acdd0527e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberCollectionTypeConverter))] + public partial class BlockchainMemberCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberCollectionTypeConverter))] + public partial interface IBlockchainMemberCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs new file mode 100644 index 000000000000..170c57ecd41a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs new file mode 100644 index 000000000000..5c465263160a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] _value; + + /// Gets or sets the collection of blockchain members. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public BlockchainMemberCollection() + { + + } + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of blockchain members. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of blockchain members.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get; set; } + + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of blockchain members. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs new file mode 100644 index 000000000000..0e89159f53b0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs new file mode 100644 index 000000000000..d7c4fd173a25 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberNodesSkuTypeConverter))] + public partial class BlockchainMemberNodesSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberNodesSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity = (int?) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberNodesSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity = (int?) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberNodesSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberNodesSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberNodesSkuTypeConverter))] + public partial interface IBlockchainMemberNodesSku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs new file mode 100644 index 000000000000..e71c0231dd6a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberNodesSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberNodesSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberNodesSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberNodesSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs new file mode 100644 index 000000000000..cb0c7e1c8e5b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial class BlockchainMemberNodesSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal + { + + /// Backing field for property. + private int? _capacity; + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public int? Capacity { get => this._capacity; set => this._capacity = value; } + + /// Creates an new instance. + public BlockchainMemberNodesSku() + { + + } + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial interface IBlockchainMemberNodesSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? Capacity { get; set; } + + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + internal partial interface IBlockchainMemberNodesSkuInternal + + { + /// Gets or sets the nodes capacity. + int? Capacity { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs new file mode 100644 index 000000000000..fee11fd68110 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial class BlockchainMemberNodesSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberNodesSku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_capacity = If( json?.PropertyT("capacity"), out var __jsonCapacity) ? (int?)__jsonCapacity : Capacity;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberNodesSku(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._capacity ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNumber((int)this._capacity) : null, "capacity" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs new file mode 100644 index 000000000000..2beeca91e2b5 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs @@ -0,0 +1,161 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesTypeConverter))] + public partial class BlockchainMemberProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesTypeConverter))] + public partial interface IBlockchainMemberProperties + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs new file mode 100644 index 000000000000..5f0d6e9dee58 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs new file mode 100644 index 000000000000..613f9634db17 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs @@ -0,0 +1,294 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal + { + + /// Backing field for property. + private string _consortium; + + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Consortium { get => this._consortium; set => this._consortium = value; } + + /// Backing field for property. + private string _consortiumManagementAccountAddress; + + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountAddress { get => this._consortiumManagementAccountAddress; } + + /// Backing field for property. + private string _consortiumManagementAccountPassword; + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountPassword { get => this._consortiumManagementAccountPassword; set => this._consortiumManagementAccountPassword = value; } + + /// Backing field for property. + private string _consortiumMemberDisplayName; + + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumMemberDisplayName { get => this._consortiumMemberDisplayName; set => this._consortiumMemberDisplayName = value; } + + /// Backing field for property. + private string _consortiumRole; + + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumRole { get => this._consortiumRole; set => this._consortiumRole = value; } + + /// Backing field for property. + private string _dns; + + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Dns { get => this._dns; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Internal Acessors for ConsortiumManagementAccountAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ConsortiumManagementAccountAddress { get => this._consortiumManagementAccountAddress; set { {_consortiumManagementAccountAddress = value;} } } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.Dns { get => this._dns; set { {_dns = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.PublicKey { get => this._publicKey; set { {_publicKey = value;} } } + + /// Internal Acessors for RootContractAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.RootContractAddress { get => this._rootContractAddress; set { {_rootContractAddress = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.UserName { get => this._userName; set { {_userName = value;} } } + + /// Internal Acessors for ValidatorNodesSku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ValidatorNodesSku { get => (this._validatorNodesSku = this._validatorNodesSku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku()); set { {_validatorNodesSku = value;} } } + + /// Backing field for property. + private string _password; + + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? _protocol; + + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => this._protocol; set => this._protocol = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? _provisioningState; + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publicKey; + + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; } + + /// Backing field for property. + private string _rootContractAddress; + + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string RootContractAddress { get => this._rootContractAddress; } + + /// Backing field for property. + private string _userName; + + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string UserName { get => this._userName; } + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public int? ValidatorNodeSkuCapacity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)ValidatorNodesSku).Capacity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)ValidatorNodesSku).Capacity = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku _validatorNodesSku; + + /// Gets or sets the blockchain validator nodes Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get => (this._validatorNodesSku = this._validatorNodesSku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku()); set => this._validatorNodesSku = value; } + + /// Creates an new instance. + public BlockchainMemberProperties() + { + + } + } + /// Payload of the blockchain member properties for a blockchain member. + public partial interface IBlockchainMemberProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + string Consortium { get; set; } + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the managed consortium management account address.", + SerializedName = @"consortiumManagementAccountAddress", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountAddress { get; } + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the dns endpoint of the blockchain member.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; } + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the public key of the blockchain member (default transaction node).", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the Ethereum root contract address of the blockchain.", + SerializedName = @"rootContractAddress", + PossibleTypes = new [] { typeof(string) })] + string RootContractAddress { get; } + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the auth user name of the blockchain member.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? ValidatorNodeSkuCapacity { get; set; } + + } + /// Payload of the blockchain member properties for a blockchain member. + internal partial interface IBlockchainMemberPropertiesInternal + + { + /// Gets or sets the consortium for the blockchain member. + string Consortium { get; set; } + /// Gets the managed consortium management account address. + string ConsortiumManagementAccountAddress { get; set; } + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + string Dns { get; set; } + /// Gets or sets firewall rules + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + string Password { get; set; } + /// Gets or sets the blockchain protocol. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; set; } + /// Gets the public key of the blockchain member (default transaction node). + string PublicKey { get; set; } + /// Gets the Ethereum root contract address of the blockchain. + string RootContractAddress { get; set; } + /// Gets the auth user name of the blockchain member. + string UserName { get; set; } + /// Gets or sets the nodes capacity. + int? ValidatorNodeSkuCapacity { get; set; } + /// Gets or sets the blockchain validator nodes Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs new file mode 100644 index 000000000000..130d4ea588fe --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs @@ -0,0 +1,153 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberProperties(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_validatorNodesSku = If( json?.PropertyT("validatorNodesSku"), out var __jsonValidatorNodesSku) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku.FromJson(__jsonValidatorNodesSku) : ValidatorNodesSku;} + {_consortium = If( json?.PropertyT("consortium"), out var __jsonConsortium) ? (string)__jsonConsortium : (string)Consortium;} + {_consortiumManagementAccountAddress = If( json?.PropertyT("consortiumManagementAccountAddress"), out var __jsonConsortiumManagementAccountAddress) ? (string)__jsonConsortiumManagementAccountAddress : (string)ConsortiumManagementAccountAddress;} + {_consortiumManagementAccountPassword = If( json?.PropertyT("consortiumManagementAccountPassword"), out var __jsonConsortiumManagementAccountPassword) ? (string)__jsonConsortiumManagementAccountPassword : (string)ConsortiumManagementAccountPassword;} + {_consortiumMemberDisplayName = If( json?.PropertyT("consortiumMemberDisplayName"), out var __jsonConsortiumMemberDisplayName) ? (string)__jsonConsortiumMemberDisplayName : (string)ConsortiumMemberDisplayName;} + {_consortiumRole = If( json?.PropertyT("consortiumRole"), out var __jsonConsortiumRole) ? (string)__jsonConsortiumRole : (string)ConsortiumRole;} + {_dns = If( json?.PropertyT("dns"), out var __jsonDns) ? (string)__jsonDns : (string)Dns;} + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + {_rootContractAddress = If( json?.PropertyT("rootContractAddress"), out var __jsonRootContractAddress) ? (string)__jsonRootContractAddress : (string)RootContractAddress;} + {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)UserName;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._validatorNodesSku ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._validatorNodesSku.ToJson(null,serializationMode) : null, "validatorNodesSku" ,container.Add ); + AddIf( null != (((object)this._consortium)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortium.ToString()) : null, "consortium" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._consortiumManagementAccountAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountAddress.ToString()) : null, "consortiumManagementAccountAddress" ,container.Add ); + } + AddIf( null != (((object)this._consortiumManagementAccountPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountPassword.ToString()) : null, "consortiumManagementAccountPassword" ,container.Add ); + AddIf( null != (((object)this._consortiumMemberDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumMemberDisplayName.ToString()) : null, "consortiumMemberDisplayName" ,container.Add ); + AddIf( null != (((object)this._consortiumRole)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumRole.ToString()) : null, "consortiumRole" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dns)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dns.ToString()) : null, "dns" ,container.Add ); + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._rootContractAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._rootContractAddress.ToString()) : null, "rootContractAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); + } + AddIf( null != (((object)this._protocol)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._protocol.ToString()) : null, "protocol" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs new file mode 100644 index 000000000000..58cef75ebfa4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Update the payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesUpdateTypeConverter))] + public partial class BlockchainMemberPropertiesUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberPropertiesUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberPropertiesUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberPropertiesUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberPropertiesUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Update the payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesUpdateTypeConverter))] + public partial interface IBlockchainMemberPropertiesUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs new file mode 100644 index 000000000000..29eb9f7a5c7f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberPropertiesUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberPropertiesUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberPropertiesUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberPropertiesUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs new file mode 100644 index 000000000000..94b84d31cf4b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs @@ -0,0 +1,73 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberPropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate __transactionNodePropertiesUpdate = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate(); + + /// Backing field for property. + private string _consortiumManagementAccountPassword; + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountPassword { get => this._consortiumManagementAccountPassword; set => this._consortiumManagementAccountPassword = value; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).FirewallRule = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).Password = value; } + + /// Creates an new instance. + public BlockchainMemberPropertiesUpdate() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__transactionNodePropertiesUpdate), __transactionNodePropertiesUpdate); + await eventListener.AssertObjectIsValid(nameof(__transactionNodePropertiesUpdate), __transactionNodePropertiesUpdate); + } + } + /// Update the payload of the blockchain member properties for a blockchain member. + public partial interface IBlockchainMemberPropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate + { + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + + } + /// Update the payload of the blockchain member properties for a blockchain member. + internal partial interface IBlockchainMemberPropertiesUpdateInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal + { + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs new file mode 100644 index 000000000000..123c832a872b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberPropertiesUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberPropertiesUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __transactionNodePropertiesUpdate = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate(json); + {_consortiumManagementAccountPassword = If( json?.PropertyT("consortiumManagementAccountPassword"), out var __jsonConsortiumManagementAccountPassword) ? (string)__jsonConsortiumManagementAccountPassword : (string)ConsortiumManagementAccountPassword;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberPropertiesUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __transactionNodePropertiesUpdate?.ToJson(container, serializationMode); + AddIf( null != (((object)this._consortiumManagementAccountPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountPassword.ToString()) : null, "consortiumManagementAccountPassword" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs new file mode 100644 index 000000000000..e55637b468bb --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTypeConverter))] + public partial class BlockchainMemberUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTypeConverter))] + public partial interface IBlockchainMemberUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs new file mode 100644 index 000000000000..a60ac8e0bdef --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs new file mode 100644 index 000000000000..1498827bf229 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs @@ -0,0 +1,108 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal + { + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)Property).ConsortiumManagementAccountPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)Property).ConsortiumManagementAccountPassword = value; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate()); set { {_property = value;} } } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate _property; + + /// Gets or sets the blockchain member update properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags _tag; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public BlockchainMemberUpdate() + { + + } + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMemberUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get; set; } + + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberUpdateInternal + + { + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member update properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Property { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs new file mode 100644 index 000000000000..76e4b495d1ce --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate.FromJson(__jsonProperties) : Property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..e963258ef2d8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTagsTypeConverter))] + public partial class BlockchainMemberUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Tags of the service which is a list of key value pairs that describes the resource. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTagsTypeConverter))] + public partial interface IBlockchainMemberUpdateTags + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..fb231741d9a8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs new file mode 100644 index 000000000000..4826aef82c30 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class BlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTagsInternal + { + + /// Creates an new instance. + public BlockchainMemberUpdateTags() + { + + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + public partial interface IBlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + + } + /// Tags of the service which is a list of key value pairs that describes the resource. + internal partial interface IBlockchainMemberUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs new file mode 100644 index 000000000000..ed992cc8d2fd --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs new file mode 100644 index 000000000000..a606902ba78f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class BlockchainMemberUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + /// + internal BlockchainMemberUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberUpdateTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs new file mode 100644 index 000000000000..50d7a2171ba0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Consortium payload + [System.ComponentModel.TypeConverter(typeof(ConsortiumTypeConverter))] + public partial class Consortium + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Consortium(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Consortium(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Consortium(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Consortium(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Consortium payload + [System.ComponentModel.TypeConverter(typeof(ConsortiumTypeConverter))] + public partial interface IConsortium + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs new file mode 100644 index 000000000000..c466631f490f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Consortium.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Consortium.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Consortium.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs new file mode 100644 index 000000000000..b0edb141e1b9 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium payload + public partial class Consortium : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets the blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? _protocol; + + /// Gets or sets the protocol for the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => this._protocol; set => this._protocol = value; } + + /// Creates an new instance. + public Consortium() + { + + } + } + /// Consortium payload + public partial interface IConsortium : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain member name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the protocol for the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the protocol for the consortium.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + + } + /// Consortium payload + internal partial interface IConsortiumInternal + + { + /// Gets or sets the blockchain member name. + string Name { get; set; } + /// Gets or sets the protocol for the consortium. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs new file mode 100644 index 000000000000..33916347f796 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium payload + public partial class Consortium + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Consortium(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Consortium(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._protocol)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._protocol.ToString()) : null, "protocol" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs new file mode 100644 index 000000000000..8944babf4328 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of the consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumCollectionTypeConverter))] + public partial class ConsortiumCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumCollectionTypeConverter))] + public partial interface IConsortiumCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs new file mode 100644 index 000000000000..fa1ecae2703d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs new file mode 100644 index 000000000000..ae5a8dee40e9 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the consortium payload. + public partial class ConsortiumCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] _value; + + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ConsortiumCollection() + { + + } + } + /// Collection of the consortium payload. + public partial interface IConsortiumCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of consortiums.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get; set; } + + } + /// Collection of the consortium payload. + internal partial interface IConsortiumCollectionInternal + + { + /// Gets or sets the collection of consortiums. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs new file mode 100644 index 000000000000..153ef1a471ea --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the consortium payload. + public partial class ConsortiumCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs new file mode 100644 index 000000000000..8118a8be8253 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Consortium approval + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberTypeConverter))] + public partial class ConsortiumMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified = (global::System.DateTime?) content.GetValueForProperty("DateModified",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate = (global::System.DateTime?) content.GetValueForProperty("JoinDate",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified = (global::System.DateTime?) content.GetValueForProperty("DateModified",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate = (global::System.DateTime?) content.GetValueForProperty("JoinDate",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Consortium approval + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberTypeConverter))] + public partial interface IConsortiumMember + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs new file mode 100644 index 000000000000..ed0876c1c3db --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs new file mode 100644 index 000000000000..c8c5e5600436 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs @@ -0,0 +1,148 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium approval + public partial class ConsortiumMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal + { + + /// Backing field for property. + private global::System.DateTime? _dateModified; + + /// Gets the consortium member modified date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? DateModified { get => this._dateModified; set => this._dateModified = value; } + + /// Backing field for property. + private string _displayName; + + /// Gets the consortium member display name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; set => this._displayName = value; } + + /// Backing field for property. + private global::System.DateTime? _joinDate; + + /// Gets the consortium member join date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? JoinDate { get => this._joinDate; set => this._joinDate = value; } + + /// Backing field for property. + private string _name; + + /// Gets the consortium member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _role; + + /// Gets the consortium member role. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Role { get => this._role; set => this._role = value; } + + /// Backing field for property. + private string _status; + + /// Gets the consortium member status. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Status { get => this._status; set => this._status = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Gets the consortium member subscription id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public ConsortiumMember() + { + + } + } + /// Consortium approval + public partial interface IConsortiumMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets the consortium member modified date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member modified date.", + SerializedName = @"dateModified", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DateModified { get; set; } + /// Gets the consortium member display name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; set; } + /// Gets the consortium member join date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member join date.", + SerializedName = @"joinDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? JoinDate { get; set; } + /// Gets the consortium member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets the consortium member role. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member role.", + SerializedName = @"role", + PossibleTypes = new [] { typeof(string) })] + string Role { get; set; } + /// Gets the consortium member status. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; set; } + /// Gets the consortium member subscription id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member subscription id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + /// Consortium approval + internal partial interface IConsortiumMemberInternal + + { + /// Gets the consortium member modified date. + global::System.DateTime? DateModified { get; set; } + /// Gets the consortium member display name. + string DisplayName { get; set; } + /// Gets the consortium member join date. + global::System.DateTime? JoinDate { get; set; } + /// Gets the consortium member name. + string Name { get; set; } + /// Gets the consortium member role. + string Role { get; set; } + /// Gets the consortium member status. + string Status { get; set; } + /// Gets the consortium member subscription id. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs new file mode 100644 index 000000000000..1d498aec5785 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium approval + public partial class ConsortiumMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumMember(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_dateModified = If( json?.PropertyT("dateModified"), out var __jsonDateModified) ? global::System.DateTime.TryParse((string)__jsonDateModified, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonDateModifiedValue) ? __jsonDateModifiedValue : DateModified : DateModified;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_joinDate = If( json?.PropertyT("joinDate"), out var __jsonJoinDate) ? global::System.DateTime.TryParse((string)__jsonJoinDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonJoinDateValue) ? __jsonJoinDateValue : JoinDate : JoinDate;} + {_role = If( json?.PropertyT("role"), out var __jsonRole) ? (string)__jsonRole : (string)Role;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumMember(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._dateModified ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dateModified?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "dateModified" ,container.Add ); + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + AddIf( null != this._joinDate ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._joinDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "joinDate" ,container.Add ); + AddIf( null != (((object)this._role)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._role.ToString()) : null, "role" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs new file mode 100644 index 000000000000..6af57915c166 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberCollectionTypeConverter))] + public partial class ConsortiumMemberCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumMemberCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumMemberCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumMemberCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumMemberCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberCollectionTypeConverter))] + public partial interface IConsortiumMemberCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs new file mode 100644 index 000000000000..98723f3933ab --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumMemberCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumMemberCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumMemberCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumMemberCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs new file mode 100644 index 000000000000..21a599ecfbdb --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs @@ -0,0 +1,73 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of consortium payload. + public partial class ConsortiumMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] _value; + + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ConsortiumMemberCollection() + { + + } + } + /// Collection of consortium payload. + public partial interface IConsortiumMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of consortiums.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get; set; } + + } + /// Collection of consortium payload. + internal partial interface IConsortiumMemberCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of consortiums. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs new file mode 100644 index 000000000000..91861a53b2d7 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of consortium payload. + public partial class ConsortiumMemberCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumMemberCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumMemberCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs new file mode 100644 index 000000000000..0d2866757b32 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Ip range for firewall rules + [System.ComponentModel.TypeConverter(typeof(FirewallRuleTypeConverter))] + public partial class FirewallRule + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FirewallRule(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FirewallRule(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FirewallRule(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress = (string) content.GetValueForProperty("EndIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName = (string) content.GetValueForProperty("RuleName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress = (string) content.GetValueForProperty("StartIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FirewallRule(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress = (string) content.GetValueForProperty("EndIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName = (string) content.GetValueForProperty("RuleName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress = (string) content.GetValueForProperty("StartIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Ip range for firewall rules + [System.ComponentModel.TypeConverter(typeof(FirewallRuleTypeConverter))] + public partial interface IFirewallRule + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs new file mode 100644 index 000000000000..7b9a9baf4540 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FirewallRuleTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FirewallRule.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FirewallRule.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FirewallRule.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs new file mode 100644 index 000000000000..17ba3202d577 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs @@ -0,0 +1,80 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Ip range for firewall rules + public partial class FirewallRule : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal + { + + /// Backing field for property. + private string _endIPAddress; + + /// Gets or sets the end IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string EndIPAddress { get => this._endIPAddress; set => this._endIPAddress = value; } + + /// Backing field for property. + private string _ruleName; + + /// Gets or sets the name of the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string RuleName { get => this._ruleName; set => this._ruleName = value; } + + /// Backing field for property. + private string _startIPAddress; + + /// Gets or sets the start IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string StartIPAddress { get => this._startIPAddress; set => this._startIPAddress = value; } + + /// Creates an new instance. + public FirewallRule() + { + + } + } + /// Ip range for firewall rules + public partial interface IFirewallRule : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the end IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the end IP address of the firewall rule range.", + SerializedName = @"endIpAddress", + PossibleTypes = new [] { typeof(string) })] + string EndIPAddress { get; set; } + /// Gets or sets the name of the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the firewall rules.", + SerializedName = @"ruleName", + PossibleTypes = new [] { typeof(string) })] + string RuleName { get; set; } + /// Gets or sets the start IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the start IP address of the firewall rule range.", + SerializedName = @"startIpAddress", + PossibleTypes = new [] { typeof(string) })] + string StartIPAddress { get; set; } + + } + /// Ip range for firewall rules + internal partial interface IFirewallRuleInternal + + { + /// Gets or sets the end IP address of the firewall rule range. + string EndIPAddress { get; set; } + /// Gets or sets the name of the firewall rules. + string RuleName { get; set; } + /// Gets or sets the start IP address of the firewall rule range. + string StartIPAddress { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs new file mode 100644 index 000000000000..7ef7ace00178 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Ip range for firewall rules + public partial class FirewallRule + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal FirewallRule(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_endIPAddress = If( json?.PropertyT("endIpAddress"), out var __jsonEndIPAddress) ? (string)__jsonEndIPAddress : (string)EndIPAddress;} + {_ruleName = If( json?.PropertyT("ruleName"), out var __jsonRuleName) ? (string)__jsonRuleName : (string)RuleName;} + {_startIPAddress = If( json?.PropertyT("startIpAddress"), out var __jsonStartIPAddress) ? (string)__jsonStartIPAddress : (string)StartIPAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new FirewallRule(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._endIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._endIPAddress.ToString()) : null, "endIpAddress" ,container.Add ); + AddIf( null != (((object)this._ruleName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._ruleName.ToString()) : null, "ruleName" ,container.Add ); + AddIf( null != (((object)this._startIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._startIPAddress.ToString()) : null, "startIpAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs new file mode 100644 index 000000000000..a65985838f00 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityTypeConverter))] + public partial class NameAvailability + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NameAvailability(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NameAvailability(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NameAvailability(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason?) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NameAvailability(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason?) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason.CreateFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Name availability payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityTypeConverter))] + public partial interface INameAvailability + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs new file mode 100644 index 000000000000..d40e577cb40b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NameAvailabilityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NameAvailability.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NameAvailability.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NameAvailability.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs new file mode 100644 index 000000000000..5e0c4214b1b6 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs @@ -0,0 +1,82 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + public partial class NameAvailability : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal + { + + /// Backing field for property. + private string _message; + + /// Gets or sets the message. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private bool? _nameAvailable; + + /// Gets or sets the value indicating whether the name is available. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public bool? NameAvailable { get => this._nameAvailable; set => this._nameAvailable = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? _reason; + + /// Gets or sets the name availability reason. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get => this._reason; set => this._reason = value; } + + /// Creates an new instance. + public NameAvailability() + { + + } + } + /// Name availability payload which is exposed in the response of the resource provider. + public partial interface INameAvailability : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the message. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Gets or sets the value indicating whether the name is available. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value indicating whether the name is available.", + SerializedName = @"nameAvailable", + PossibleTypes = new [] { typeof(bool) })] + bool? NameAvailable { get; set; } + /// Gets or sets the name availability reason. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name availability reason.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get; set; } + + } + /// Name availability payload which is exposed in the response of the resource provider. + internal partial interface INameAvailabilityInternal + + { + /// Gets or sets the message. + string Message { get; set; } + /// Gets or sets the value indicating whether the name is available. + bool? NameAvailable { get; set; } + /// Gets or sets the name availability reason. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs new file mode 100644 index 000000000000..bbbd15448d59 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + public partial class NameAvailability + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new NameAvailability(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal NameAvailability(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_nameAvailable = If( json?.PropertyT("nameAvailable"), out var __jsonNameAvailable) ? (bool?)__jsonNameAvailable : NameAvailable;} + {_reason = If( json?.PropertyT("reason"), out var __jsonReason) ? (string)__jsonReason : (string)Reason;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != this._nameAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonBoolean((bool)this._nameAvailable) : null, "nameAvailable" ,container.Add ); + AddIf( null != (((object)this._reason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._reason.ToString()) : null, "reason" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs new file mode 100644 index 000000000000..ae9c323beebf --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityRequestTypeConverter))] + public partial class NameAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NameAvailabilityRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NameAvailabilityRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NameAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NameAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Name availability request payload which is exposed in the request of the resource provider. + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityRequestTypeConverter))] + public partial interface INameAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs new file mode 100644 index 000000000000..ed3936510961 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NameAvailabilityRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NameAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NameAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NameAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs new file mode 100644 index 000000000000..593c798711d8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + public partial class NameAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets the name to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public NameAvailabilityRequest() + { + + } + } + /// Name availability request payload which is exposed in the request of the resource provider. + public partial interface INameAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the name to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name to check.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the type of the resource to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of the resource to check.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Name availability request payload which is exposed in the request of the resource provider. + internal partial interface INameAvailabilityRequestInternal + + { + /// Gets or sets the name to check. + string Name { get; set; } + /// Gets or sets the type of the resource to check. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs new file mode 100644 index 000000000000..63635686c57e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + public partial class NameAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new NameAvailabilityRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal NameAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs new file mode 100644 index 000000000000..78d30a3116af --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(OperationResultTypeConverter))] + public partial class OperationResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation result payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(OperationResultTypeConverter))] + public partial interface IOperationResult + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs new file mode 100644 index 000000000000..3c3dd68b6f01 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs new file mode 100644 index 000000000000..19ec9c808d01 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs @@ -0,0 +1,82 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + public partial class OperationResult : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal + { + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// Gets or sets the operation end time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Gets or sets the operation start time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public OperationResult() + { + + } + } + /// Operation result payload which is exposed in the response of the resource provider. + public partial interface IOperationResult : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the operation end time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the operation start time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + + } + /// Operation result payload which is exposed in the response of the resource provider. + internal partial interface IOperationResultInternal + + { + /// Gets or sets the operation end time. + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the operation name. + string Name { get; set; } + /// Gets or sets the operation start time. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs new file mode 100644 index 000000000000..2ea176deb1ec --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + public partial class OperationResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new OperationResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal OperationResult(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs new file mode 100644 index 000000000000..3d0aeead2354 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// The core properties of the resources. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The core properties of the resources. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs new file mode 100644 index 000000000000..75a5af159550 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs new file mode 100644 index 000000000000..b044ca3d1d37 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs @@ -0,0 +1,89 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The core properties of the resources. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// The core properties of the resources. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Fully qualified resource Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the service - e.g. ""Microsoft.Blockchain""", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The core properties of the resources. + internal partial interface IResourceInternal + + { + /// Fully qualified resource Id of the resource. + string Id { get; set; } + /// The name of the resource. + string Name { get; set; } + /// The type of the service - e.g. "Microsoft.Blockchain" + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs new file mode 100644 index 000000000000..c6d79939feba --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The core properties of the resources. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs new file mode 100644 index 000000000000..a39d6a42caf8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationTypeConverter))] + public partial class ResourceProviderOperation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationTypeConverter))] + public partial interface IResourceProviderOperation + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs new file mode 100644 index 000000000000..2c5e7899e2d4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs new file mode 100644 index 000000000000..03949863f65a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs @@ -0,0 +1,148 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Operation payload which is exposed in the response of the resource provider. + public partial class ResourceProviderOperation : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay _display; + + /// Gets or sets operation display + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay()); set => this._display = value; } + + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Description = value; } + + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Operation = value; } + + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Provider = value; } + + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Resource = value; } + + /// Backing field for property. + private bool? _isDataAction; + + /// Gets or sets a value indicating whether the operation is a data action or not. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay()); set { {_display = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _origin; + + /// Gets or sets the origin. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Origin { get => this._origin; set => this._origin = value; } + + /// Creates an new instance. + public ResourceProviderOperation() + { + + } + } + /// Operation payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperation : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description of the provider for display purposes.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the operation for display purposes.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the provider for display purposes.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the resource type for display purposes.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// Gets or sets a value indicating whether the operation is a data action or not. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether the operation is a data action or not.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; set; } + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the origin. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the origin.", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; set; } + + } + /// Operation payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationInternal + + { + /// Gets or sets operation display + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Display { get; set; } + /// Gets or sets the description of the provider for display purposes. + string DisplayDescription { get; set; } + /// Gets or sets the name of the operation for display purposes. + string DisplayOperation { get; set; } + /// Gets or sets the name of the provider for display purposes. + string DisplayProvider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + string DisplayResource { get; set; } + /// Gets or sets a value indicating whether the operation is a data action or not. + bool? IsDataAction { get; set; } + /// Gets or sets the operation name. + string Name { get; set; } + /// Gets or sets the origin. + string Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs new file mode 100644 index 000000000000..c5e72e017a0d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Operation payload which is exposed in the response of the resource provider. + public partial class ResourceProviderOperation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperation(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs new file mode 100644 index 000000000000..430f03558d82 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationCollectionTypeConverter))] + public partial class ResourceProviderOperationCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperationCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperationCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperationCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperationCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationCollectionTypeConverter))] + public partial interface IResourceProviderOperationCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs new file mode 100644 index 000000000000..d413010dde86 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperationCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperationCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperationCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs new file mode 100644 index 000000000000..d851b2b848b4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] _value; + + /// Gets or sets the collection of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ResourceProviderOperationCollection() + { + + } + } + /// Collection of operation payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperationCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of operations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get; set; } + + } + /// Collection of operation payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of operations. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs new file mode 100644 index 000000000000..b08ba5c12e02 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperationCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperationCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs new file mode 100644 index 000000000000..8a2fed6e99fe --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationDisplayTypeConverter))] + public partial class ResourceProviderOperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperationDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperationDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation display payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationDisplayTypeConverter))] + public partial interface IResourceProviderOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs new file mode 100644 index 000000000000..49cc07d9699d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs new file mode 100644 index 000000000000..ac7faf160fcc --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public ResourceProviderOperationDisplay() + { + + } + } + /// Operation display payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description of the provider for display purposes.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the operation for display purposes.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the provider for display purposes.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the resource type for display purposes.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// Operation display payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationDisplayInternal + + { + /// Gets or sets the description of the provider for display purposes. + string Description { get; set; } + /// Gets or sets the name of the operation for display purposes. + string Operation { get; set; } + /// Gets or sets the name of the provider for display purposes. + string Provider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs new file mode 100644 index 000000000000..db98858273a2 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs new file mode 100644 index 000000000000..2ba7601fff2a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuTypeConverter))] + public partial class ResourceTypeSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTypeSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTypeSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTypeSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[]) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSettingTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTypeSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[]) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSettingTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuTypeConverter))] + public partial interface IResourceTypeSku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs new file mode 100644 index 000000000000..db54cd47862d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTypeSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTypeSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTypeSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs new file mode 100644 index 000000000000..ca12c0a9d510 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Resource type Sku. + public partial class ResourceTypeSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal + { + + /// Backing field for property. + private string _resourceType; + + /// Gets or sets the resource type + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] _sku; + + /// Gets or sets the Skus + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get => this._sku; set => this._sku = value; } + + /// Creates an new instance. + public ResourceTypeSku() + { + + } + } + /// Resource type Sku. + public partial interface IResourceTypeSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the resource type + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource type", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + /// Gets or sets the Skus + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Skus", + SerializedName = @"skus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get; set; } + + } + /// Resource type Sku. + internal partial interface IResourceTypeSkuInternal + + { + /// Gets or sets the resource type + string ResourceType { get; set; } + /// Gets or sets the Skus + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs new file mode 100644 index 000000000000..2505d9e5e76c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Resource type Sku. + public partial class ResourceTypeSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceTypeSku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceTypeSku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + {_sku = If( json?.PropertyT("skus"), out var __jsonSkus) ? If( __jsonSkus as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting.FromJson(__u) )) ))() : null : Sku;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + if (null != this._sku) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._sku ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("skus",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs new file mode 100644 index 000000000000..773020c1ad9e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of the resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuCollectionTypeConverter))] + public partial class ResourceTypeSkuCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTypeSkuCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTypeSkuCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTypeSkuCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTypeSkuCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuCollectionTypeConverter))] + public partial interface IResourceTypeSkuCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs new file mode 100644 index 000000000000..67b827570eef --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeSkuCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTypeSkuCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTypeSkuCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTypeSkuCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs new file mode 100644 index 000000000000..de00c3e71b74 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the resource type Sku. + public partial class ResourceTypeSkuCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] _value; + + /// Gets or sets the collection of resource type Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ResourceTypeSkuCollection() + { + + } + } + /// Collection of the resource type Sku. + public partial interface IResourceTypeSkuCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of resource type Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of resource type Sku.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get; set; } + + } + /// Collection of the resource type Sku. + internal partial interface IResourceTypeSkuCollectionInternal + + { + /// Gets or sets the collection of resource type Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs new file mode 100644 index 000000000000..e881b24854af --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the resource type Sku. + public partial class ResourceTypeSkuCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceTypeSkuCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceTypeSkuCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs new file mode 100644 index 000000000000..98de7ccf3026 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Blockchain member Sku in payload + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial class Sku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Sku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Sku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Sku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Sku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Blockchain member Sku in payload + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial interface ISku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs new file mode 100644 index 000000000000..9e82631a1be8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Sku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Sku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Sku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs new file mode 100644 index 000000000000..a7dea32d61e0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Blockchain member Sku in payload + public partial class Sku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _tier; + + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Tier { get => this._tier; set => this._tier = value; } + + /// Creates an new instance. + public Sku() + { + + } + } + /// Blockchain member Sku in payload + public partial interface ISku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string Tier { get; set; } + + } + /// Blockchain member Sku in payload + internal partial interface ISkuInternal + + { + /// Gets or sets Sku name + string Name { get; set; } + /// Gets or sets Sku tier + string Tier { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs new file mode 100644 index 000000000000..722897b7fc7e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Blockchain member Sku in payload + public partial class Sku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Sku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Sku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_tier = If( json?.PropertyT("tier"), out var __jsonTier) ? (string)__jsonTier : (string)Tier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._tier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._tier.ToString()) : null, "tier" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs new file mode 100644 index 000000000000..32c2ae789d3c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Sku Setting. + [System.ComponentModel.TypeConverter(typeof(SkuSettingTypeConverter))] + public partial class SkuSetting + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuSetting(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuSetting(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuSetting(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location = (string[]) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature = (string[]) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SkuSetting(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location = (string[]) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature = (string[]) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Sku Setting. + [System.ComponentModel.TypeConverter(typeof(SkuSettingTypeConverter))] + public partial interface ISkuSetting + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs new file mode 100644 index 000000000000..27575ef9caca --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuSettingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuSetting.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuSetting.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuSetting.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs new file mode 100644 index 000000000000..5ea37fe4da29 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs @@ -0,0 +1,97 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Sku Setting. + public partial class SkuSetting : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal + { + + /// Backing field for property. + private string[] _location; + + /// Gets or sets the locations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string[] Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the Sku name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string[] _requiredFeature; + + /// Gets or sets the required features. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string[] RequiredFeature { get => this._requiredFeature; set => this._requiredFeature = value; } + + /// Backing field for property. + private string _tier; + + /// Gets or sets the Sku tier. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Tier { get => this._tier; set => this._tier = value; } + + /// Creates an new instance. + public SkuSetting() + { + + } + } + /// Sku Setting. + public partial interface ISkuSetting : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the locations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the locations.", + SerializedName = @"locations", + PossibleTypes = new [] { typeof(string) })] + string[] Location { get; set; } + /// Gets or sets the Sku name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the required features. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the required features.", + SerializedName = @"requiredFeatures", + PossibleTypes = new [] { typeof(string) })] + string[] RequiredFeature { get; set; } + /// Gets or sets the Sku tier. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sku tier.", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string Tier { get; set; } + + } + /// Sku Setting. + internal partial interface ISkuSettingInternal + + { + /// Gets or sets the locations. + string[] Location { get; set; } + /// Gets or sets the Sku name. + string Name { get; set; } + /// Gets or sets the required features. + string[] RequiredFeature { get; set; } + /// Gets or sets the Sku tier. + string Tier { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs new file mode 100644 index 000000000000..067eb934dc77 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Sku Setting. + public partial class SkuSetting + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new SkuSetting(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal SkuSetting(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_location = If( json?.PropertyT("locations"), out var __jsonLocations) ? If( __jsonLocations as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Location;} + {_requiredFeature = If( json?.PropertyT("requiredFeatures"), out var __jsonRequiredFeatures) ? If( __jsonRequiredFeatures as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : RequiredFeature;} + {_tier = If( json?.PropertyT("tier"), out var __jsonTier) ? (string)__jsonTier : (string)Tier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + if (null != this._location) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._location ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("locations",__w); + } + if (null != this._requiredFeature) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __s in this._requiredFeature ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("requiredFeatures",__r); + } + AddIf( null != (((object)this._tier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._tier.ToString()) : null, "tier" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs new file mode 100644 index 000000000000..01d3e952fb16 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// The resource model definition for a top level resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial class TrackedResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// The resource model definition for a top level resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial interface ITrackedResource + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs new file mode 100644 index 000000000000..044183dd19e8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs new file mode 100644 index 000000000000..0eb37374e947 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The resource model definition for a top level resource. + public partial class TrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(); + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags _tag; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags()); set => this._tag = value; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public TrackedResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The resource model definition for a top level resource. + public partial interface ITrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource + { + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GEO location of the blockchain service.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get; set; } + + } + /// The resource model definition for a top level resource. + internal partial interface ITrackedResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + /// The GEO location of the blockchain service. + string Location { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs new file mode 100644 index 000000000000..2e361b35c33a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The resource model definition for a top level resource. + public partial class TrackedResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(json); + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs new file mode 100644 index 000000000000..db1c1bdda9df --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial class TrackedResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResourceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResourceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial interface ITrackedResourceTags + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs new file mode 100644 index 000000000000..fd2f75e18216 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs new file mode 100644 index 000000000000..c7932352bdb3 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTagsInternal + { + + /// Creates an new instance. + public TrackedResourceTags() + { + + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + public partial interface ITrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + + } + /// Tags of the service which is a list of key value pairs that describes the resource. + internal partial interface ITrackedResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs new file mode 100644 index 000000000000..cf14c471be1a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs new file mode 100644 index 000000000000..dfc23ff6c7d7 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class TrackedResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + /// + internal TrackedResourceTags(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs new file mode 100644 index 000000000000..15a0e7feb561 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs @@ -0,0 +1,153 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeTypeConverter))] + public partial class TransactionNode + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNode(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNode(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNode(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNode(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Payload of the transaction node which is the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeTypeConverter))] + public partial interface ITransactionNode + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs new file mode 100644 index 000000000000..0176db2bf484 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNode.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNode.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNode.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs new file mode 100644 index 000000000000..98dad61abb63 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs @@ -0,0 +1,196 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + public partial class TransactionNode : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(); + + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).FirewallRule = value; } + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// Gets or sets the transaction node location. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey = value; } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties _property; + + /// Gets or sets the blockchain member properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties()); set => this._property = value; } + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState; } + + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; } + + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName; } + + /// Creates an new instance. + public TransactionNode() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Payload of the transaction node which is the request/response of the resource provider. + public partial interface ITransactionNode : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource + { + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Gets or sets the transaction node location. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the transaction node location.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; } + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node public key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint basic auth user name.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + + } + /// Payload of the transaction node which is the request/response of the resource provider. + internal partial interface ITransactionNodeInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + /// Gets or sets the transaction node dns endpoint. + string Dns { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Gets or sets the transaction node location. + string Location { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Property { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the transaction node public key. + string PublicKey { get; set; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + string UserName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs new file mode 100644 index 000000000000..91b2c303d88f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + public partial class TransactionNode + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNode(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNode(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties.FromJson(__jsonProperties) : Property;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs new file mode 100644 index 000000000000..02c31b73ae5b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeCollectionTypeConverter))] + public partial class TransactionNodeCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeCollectionTypeConverter))] + public partial interface ITransactionNodeCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs new file mode 100644 index 000000000000..9e8ff2905951 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs new file mode 100644 index 000000000000..671644b2e474 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] _value; + + /// Gets or sets the collection of transaction nodes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public TransactionNodeCollection() + { + + } + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + public partial interface ITransactionNodeCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of transaction nodes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of transaction nodes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get; set; } + + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + internal partial interface ITransactionNodeCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of transaction nodes. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs new file mode 100644 index 000000000000..049d3c91095d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs new file mode 100644 index 000000000000..fec1ebb2abd4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of transaction node properties payload in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesTypeConverter))] + public partial class TransactionNodeProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Payload of transaction node properties payload in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesTypeConverter))] + public partial interface ITransactionNodeProperties + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs new file mode 100644 index 000000000000..886b18bea90a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs new file mode 100644 index 000000000000..fcc192f6ee84 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of transaction node properties payload in the transaction node payload. + public partial class TransactionNodeProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal + { + + /// Backing field for property. + private string _dns; + + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Dns { get => this._dns; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.Dns { get => this._dns; set { {_dns = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.PublicKey { get => this._publicKey; set { {_publicKey = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.UserName { get => this._userName; set { {_userName = value;} } } + + /// Backing field for property. + private string _password; + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? _provisioningState; + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publicKey; + + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; } + + /// Backing field for property. + private string _userName; + + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string UserName { get => this._userName; } + + /// Creates an new instance. + public TransactionNodeProperties() + { + + } + } + /// Payload of transaction node properties payload in the transaction node payload. + public partial interface ITransactionNodeProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; } + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node public key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint basic auth user name.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + + } + /// Payload of transaction node properties payload in the transaction node payload. + internal partial interface ITransactionNodePropertiesInternal + + { + /// Gets or sets the transaction node dns endpoint. + string Dns { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the transaction node public key. + string PublicKey { get; set; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + string UserName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs new file mode 100644 index 000000000000..70224d1d945f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of transaction node properties payload in the transaction node payload. + public partial class TransactionNodeProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dns)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dns.ToString()) : null, "dns" ,container.Add ); + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeProperties(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dns = If( json?.PropertyT("dns"), out var __jsonDns) ? (string)__jsonDns : (string)Dns;} + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)UserName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs new file mode 100644 index 000000000000..a1b14f4b1b74 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesUpdateTypeConverter))] + public partial class TransactionNodePropertiesUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodePropertiesUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodePropertiesUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodePropertiesUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodePropertiesUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Update the payload of the transaction node properties in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesUpdateTypeConverter))] + public partial interface ITransactionNodePropertiesUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs new file mode 100644 index 000000000000..b2d28264ca7c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodePropertiesUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodePropertiesUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodePropertiesUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodePropertiesUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs new file mode 100644 index 000000000000..34769b7d7fa2 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + public partial class TransactionNodePropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Backing field for property. + private string _password; + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Creates an new instance. + public TransactionNodePropertiesUpdate() + { + + } + } + /// Update the payload of the transaction node properties in the transaction node payload. + public partial interface ITransactionNodePropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + + } + /// Update the payload of the transaction node properties in the transaction node payload. + internal partial interface ITransactionNodePropertiesUpdateInternal + + { + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs new file mode 100644 index 000000000000..af3d4171d010 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + public partial class TransactionNodePropertiesUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodePropertiesUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodePropertiesUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs new file mode 100644 index 000000000000..aec5fa837f43 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeUpdateTypeConverter))] + public partial class TransactionNodeUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeUpdateTypeConverter))] + public partial interface ITransactionNodeUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs new file mode 100644 index 000000000000..83a25b824faa --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs new file mode 100644 index 000000000000..ed3b4417ab65 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs @@ -0,0 +1,71 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal + { + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate()); set { {_property = value;} } } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate _property; + + /// Gets or sets the transaction node update properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate()); set => this._property = value; } + + /// Creates an new instance. + public TransactionNodeUpdate() + { + + } + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + public partial interface ITransactionNodeUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + internal partial interface ITransactionNodeUpdateInternal + + { + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the transaction node update properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs new file mode 100644 index 000000000000..771a5cc74cf3 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs new file mode 100644 index 000000000000..9e98423a5f68 --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs @@ -0,0 +1,146 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(BlockchainIdentityTypeConverter))] + public partial class BlockchainIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName = (string) content.GetValueForProperty("BlockchainMemberName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName = (string) content.GetValueForProperty("TransactionNodeName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName = (string) content.GetValueForProperty("BlockchainMemberName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName = (string) content.GetValueForProperty("TransactionNodeName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(BlockchainIdentityTypeConverter))] + public partial interface IBlockchainIdentity + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs new file mode 100644 index 000000000000..6d021b07e90d --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new BlockchainIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.cs new file mode 100644 index 000000000000..4faa1288dc16 --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.cs @@ -0,0 +1,168 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal + { + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _location; + + /// Location Name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _operationId; + + /// Operation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// Creates an new instance. + public BlockchainIdentity() + { + + } + } + public partial interface IBlockchainIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + string BlockchainMemberName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// Location Name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Operation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operation Id.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + /// Transaction node name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + string TransactionNodeName { get; set; } + + } + internal partial interface IBlockchainIdentityInternal + + { + /// Blockchain member name. + string BlockchainMemberName { get; set; } + /// Resource identity path + string Id { get; set; } + /// Location Name. + string Location { get; set; } + /// Operation Id. + string OperationId { get; set; } + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + string ResourceGroupName { get; set; } + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + string SubscriptionId { get; set; } + /// Transaction node name. + string TransactionNodeName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs new file mode 100644 index 000000000000..7032f22fedbf --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs @@ -0,0 +1,117 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainIdentity(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_blockchainMemberName = If( json?.PropertyT("blockchainMemberName"), out var __jsonBlockchainMemberName) ? (string)__jsonBlockchainMemberName : (string)BlockchainMemberName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_transactionNodeName = If( json?.PropertyT("transactionNodeName"), out var __jsonTransactionNodeName) ? (string)__jsonTransactionNodeName : (string)TransactionNodeName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainIdentity(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._blockchainMemberName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._blockchainMemberName.ToString()) : null, "blockchainMemberName" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._transactionNodeName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._transactionNodeName.ToString()) : null, "transactionNodeName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs new file mode 100644 index 000000000000..c93f93dbe0a7 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs @@ -0,0 +1,55 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for BlockchainMemberProvisioningState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningStateTypeConverter))] + public partial struct BlockchainMemberProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Updating", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Deleting", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Stale".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Stale", "Stale", global::System.Management.Automation.CompletionResultType.ParameterValue, "Stale"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..8b9058baaca8 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for BlockchainMemberProvisioningState. + public partial class BlockchainMemberProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => BlockchainMemberProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs new file mode 100644 index 000000000000..ac5f927f69a6 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs @@ -0,0 +1,111 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct BlockchainMemberProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Stale = @"Stale"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Updating = @"Updating"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// + /// Creates an instance of the + /// + /// the value to create an instance for. + private BlockchainMemberProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to BlockchainMemberProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new BlockchainMemberProvisioningState(System.Convert.ToString(value)); + } + + /// Compares values of enum type BlockchainMemberProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type BlockchainMemberProvisioningState (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is BlockchainMemberProvisioningState && Equals((BlockchainMemberProvisioningState)obj); + } + + /// Returns hashCode for enum BlockchainMemberProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for BlockchainMemberProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to BlockchainMemberProvisioningState + /// the value to convert to an instance of . + + public static implicit operator BlockchainMemberProvisioningState(string value) + { + return new BlockchainMemberProvisioningState(value); + } + + /// Implicit operator to convert BlockchainMemberProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum BlockchainMemberProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum BlockchainMemberProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs new file mode 100644 index 000000000000..bc7757d35ca4 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs @@ -0,0 +1,47 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for BlockchainProtocol. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocolTypeConverter))] + public partial struct BlockchainProtocol : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Parity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Parity", "Parity", global::System.Management.Automation.CompletionResultType.ParameterValue, "Parity"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Quorum".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Quorum", "Quorum", global::System.Management.Automation.CompletionResultType.ParameterValue, "Quorum"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Corda".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Corda", "Corda", global::System.Management.Automation.CompletionResultType.ParameterValue, "Corda"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs new file mode 100644 index 000000000000..1a1d47940058 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for BlockchainProtocol. + public partial class BlockchainProtocolTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => BlockchainProtocol.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.cs new file mode 100644 index 000000000000..5beaee1c1a1b --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.cs @@ -0,0 +1,101 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct BlockchainProtocol : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Corda = @"Corda"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Parity = @"Parity"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Quorum = @"Quorum"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the + /// the value to create an instance for. + private BlockchainProtocol(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to BlockchainProtocol + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new BlockchainProtocol(System.Convert.ToString(value)); + } + + /// Compares values of enum type BlockchainProtocol + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type BlockchainProtocol (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is BlockchainProtocol && Equals((BlockchainProtocol)obj); + } + + /// Returns hashCode for enum BlockchainProtocol + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for BlockchainProtocol + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to BlockchainProtocol + /// the value to convert to an instance of . + + public static implicit operator BlockchainProtocol(string value) + { + return new BlockchainProtocol(value); + } + + /// Implicit operator to convert BlockchainProtocol to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e) + { + return e._value; + } + + /// Overriding != operator for enum BlockchainProtocol + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum BlockchainProtocol + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs new file mode 100644 index 000000000000..af9e17fc4f14 --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs @@ -0,0 +1,43 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for NameAvailabilityReason. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReasonTypeConverter))] + public partial struct NameAvailabilityReason : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AlreadyExists".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("AlreadyExists", "AlreadyExists", global::System.Management.Automation.CompletionResultType.ParameterValue, "AlreadyExists"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Invalid".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Invalid", "Invalid", global::System.Management.Automation.CompletionResultType.ParameterValue, "Invalid"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs new file mode 100644 index 000000000000..6d809191322d --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for NameAvailabilityReason. + public partial class NameAvailabilityReasonTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NameAvailabilityReason.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs new file mode 100644 index 000000000000..a9a2ac91323b --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs @@ -0,0 +1,99 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct NameAvailabilityReason : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason AlreadyExists = @"AlreadyExists"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason Invalid = @"Invalid"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason NotSpecified = @"NotSpecified"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to NameAvailabilityReason + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new NameAvailabilityReason(System.Convert.ToString(value)); + } + + /// Compares values of enum type NameAvailabilityReason + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type NameAvailabilityReason (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is NameAvailabilityReason && Equals((NameAvailabilityReason)obj); + } + + /// Returns hashCode for enum NameAvailabilityReason + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private NameAvailabilityReason(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for NameAvailabilityReason + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to NameAvailabilityReason + /// the value to convert to an instance of . + + public static implicit operator NameAvailabilityReason(string value) + { + return new NameAvailabilityReason(value); + } + + /// Implicit operator to convert NameAvailabilityReason to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e) + { + return e._value; + } + + /// Overriding != operator for enum NameAvailabilityReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum NameAvailabilityReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs new file mode 100644 index 000000000000..59b52b9af1c0 --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs @@ -0,0 +1,51 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for NodeProvisioningState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningStateTypeConverter))] + public partial struct NodeProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Updating", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Deleting", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..34843d8be9aa --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for NodeProvisioningState. + public partial class NodeProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NodeProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.cs new file mode 100644 index 000000000000..f05019dcf44d --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.cs @@ -0,0 +1,103 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct NodeProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Updating = @"Updating"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to NodeProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new NodeProvisioningState(System.Convert.ToString(value)); + } + + /// Compares values of enum type NodeProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type NodeProvisioningState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is NodeProvisioningState && Equals((NodeProvisioningState)obj); + } + + /// Returns hashCode for enum NodeProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private NodeProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for NodeProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to NodeProvisioningState + /// the value to convert to an instance of . + + public static implicit operator NodeProvisioningState(string value) + { + return new NodeProvisioningState(value); + } + + /// Implicit operator to convert NodeProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum NodeProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum NodeProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs new file mode 100644 index 000000000000..f52ab75e9cb1 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs @@ -0,0 +1,337 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the available consortiums for a subscription. + /// + /// [OpenAPI] Locations_ListConsortiums=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/listConsortiums" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainConsortium_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the available consortiums for a subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainConsortium_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// Location Name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Location Name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainConsortium_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LocationsListConsortiums' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsListConsortiums(Location, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Location=Location,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs new file mode 100644 index 000000000000..2669d488a1ab --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs @@ -0,0 +1,354 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_ListApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMemberApiKey_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMemberApiKey_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMemberApiKey_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersListApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListApiKeys(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs new file mode 100644 index 000000000000..b61896db922b --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs @@ -0,0 +1,361 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the consortium members for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_ListConsortiumMembers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMemberConsortiumMember_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the consortium members for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMemberConsortiumMember_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMemberConsortiumMember_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListConsortiumMembers(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListConsortiumMembers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs new file mode 100644 index 000000000000..1a6eb4dd4dfa --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs @@ -0,0 +1,351 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get details about a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get details about a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersGet(Name, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs new file mode 100644 index 000000000000..f097feaff504 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs @@ -0,0 +1,323 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get details about a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get details about a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersGet(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs new file mode 100644 index 000000000000..360e61e88944 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs @@ -0,0 +1,347 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the blockchain members for a resource group. + /// + /// [OpenAPI] BlockchainMembers_List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the blockchain members for a resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersList(SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs new file mode 100644 index 000000000000..a3aadf7de6a8 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs @@ -0,0 +1,330 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the blockchain members for a subscription. + /// + /// [OpenAPI] BlockchainMembers_ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the blockchain members for a subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListAll(SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListAll_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs new file mode 100644 index 000000000000..fd98e3a474bd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs @@ -0,0 +1,307 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// + /// [OpenAPI] Operations_List=>GET:"/providers/Microsoft.Blockchain/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the available operations of Microsoft.Blockchain resource provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs new file mode 100644 index 000000000000..32ba093777ea --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs @@ -0,0 +1,320 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the Skus of the resource type. + /// + /// [OpenAPI] Skus_List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainSku_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the Skus of the resource type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainSku_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainSku_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SkusList(SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs new file mode 100644 index 000000000000..18092a0acd65 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs @@ -0,0 +1,368 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// List the API keys for the transaction node. + /// + /// [OpenAPI] TransactionNodes_ListApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNodeApiKey_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"List the API keys for the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNodeApiKey_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNodeApiKey_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesListApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesListApiKeys(BlockchainMemberName, TransactionNodeName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,TransactionNodeName=TransactionNodeName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs new file mode 100644 index 000000000000..84a04153f283 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs @@ -0,0 +1,365 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get the details of the transaction node. + /// + /// [OpenAPI] TransactionNodes_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get the details of the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesGet(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs new file mode 100644 index 000000000000..67a067068323 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs @@ -0,0 +1,327 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get the details of the transaction node. + /// + /// [OpenAPI] TransactionNodes_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get the details of the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesGet(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs new file mode 100644 index 000000000000..b6dd542170bf --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs @@ -0,0 +1,361 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the transaction nodes for a blockchain member. + /// + /// [OpenAPI] TransactionNodes_List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the transaction nodes for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesList(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs new file mode 100644 index 000000000000..b745fa2db13b --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs @@ -0,0 +1,381 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMemberApiKey_RegenerateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMemberApiKey_RegenerateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMemberApiKey_RegenerateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersRegenerateApiKeys(BlockchainMemberName, SubscriptionId, ResourceGroupName, ApiKeyBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs new file mode 100644 index 000000000000..0eff45f441a2 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs @@ -0,0 +1,357 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersRegenerateApiKeysViaIdentity(InputObject.Id, ApiKeyBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersRegenerateApiKeys(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, ApiKeyBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs new file mode 100644 index 000000000000..cc332329d651 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs @@ -0,0 +1,564 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Create a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMember_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Create a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMember_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember(); + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Gets or sets the consortium for the blockchain member. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the consortium for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + public string Consortium { get => BlockchainMemberBody.Consortium ?? null; set => BlockchainMemberBody.Consortium = value; } + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// Gets the display name of the member in the consortium. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the display name of the member in the consortium.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumMemberDisplayName { get => BlockchainMemberBody.ConsortiumMemberDisplayName ?? null; set => BlockchainMemberBody.ConsortiumMemberDisplayName = value; } + + /// Gets the role of the member in the consortium. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the role of the member in the consortium.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumRole { get => BlockchainMemberBody.ConsortiumRole ?? null; set => BlockchainMemberBody.ConsortiumRole = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets firewall rules + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets firewall rules")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The GEO location of the blockchain service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GEO location of the blockchain service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GEO location of the blockchain service.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => BlockchainMemberBody.Location ?? null; set => BlockchainMemberBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Sets the basic auth password of the blockchain member. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the basic auth password of the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// Gets or sets the blockchain protocol. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the blockchain protocol.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol))] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Protocol { get => BlockchainMemberBody.Protocol ?? ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol)""); set => BlockchainMemberBody.Protocol = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Gets or sets Sku name + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets Sku name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string SkuName { get => BlockchainMemberBody.SkuName ?? null; set => BlockchainMemberBody.SkuName = value; } + + /// Gets or sets Sku tier + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets Sku tier")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + public string SkuTier { get => BlockchainMemberBody.SkuTier ?? null; set => BlockchainMemberBody.SkuTier = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// Gets or sets the nodes capacity. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the nodes capacity.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + public int ValidatorNodeSkuCapacity { get => BlockchainMemberBody.ValidatorNodeSkuCapacity ?? default(int); set => BlockchainMemberBody.ValidatorNodeSkuCapacity = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzBlockchainMember_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.NewAzBlockchainMember_CreateExpanded Clone() + { + var clone = new NewAzBlockchainMember_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.BlockchainMemberBody = this.BlockchainMemberBody; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMember_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersCreate(Name, SubscriptionId, ResourceGroupName, BlockchainMemberBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs new file mode 100644 index 000000000000..929c4cb22391 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs @@ -0,0 +1,395 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for the blockchain member. + /// + /// [OpenAPI] TransactionNodes_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNodeApiKey_RegenerateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesRegenerateApiKeys(BlockchainMemberName, TransactionNodeName, SubscriptionId, ResourceGroupName, ApiKeyBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,TransactionNodeName=TransactionNodeName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs new file mode 100644 index 000000000000..c1673eb6a110 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs @@ -0,0 +1,362 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for the blockchain member. + /// + /// [OpenAPI] TransactionNodes_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesRegenerateApiKeysViaIdentity(InputObject.Id, ApiKeyBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesRegenerateApiKeys(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, ApiKeyBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs new file mode 100644 index 000000000000..3284d784a0dd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs @@ -0,0 +1,476 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Create or update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNode_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Create or update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNode_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the transaction node location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the transaction node location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the transaction node location.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => TransactionNodeBody.Location ?? null; set => TransactionNodeBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode(); + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzBlockchainTransactionNode_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.NewAzBlockchainTransactionNode_CreateExpanded Clone() + { + var clone = new NewAzBlockchainTransactionNode_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.TransactionNodeBody = this.TransactionNodeBody; + clone.BlockchainMemberName = this.BlockchainMemberName; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainTransactionNode_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesCreate(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, TransactionNodeBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs new file mode 100644 index 000000000000..8dc7609c7611 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs @@ -0,0 +1,422 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainMember_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainMember_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainMember_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainMember_Delete Clone() + { + var clone = new RemoveAzBlockchainMember_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersDelete(Name, SubscriptionId, ResourceGroupName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainMember_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs new file mode 100644 index 000000000000..4c1ebbf70d4d --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs @@ -0,0 +1,394 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainMember_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainMember_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainMember_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainMember_DeleteViaIdentity Clone() + { + var clone = new RemoveAzBlockchainMember_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersDelete(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainMember_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs new file mode 100644 index 000000000000..35cf177f7ecd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs @@ -0,0 +1,437 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete the transaction node. + /// + /// [OpenAPI] TransactionNodes_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainTransactionNode_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainTransactionNode_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainTransactionNode_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainTransactionNode_Delete Clone() + { + var clone = new RemoveAzBlockchainTransactionNode_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.BlockchainMemberName = this.BlockchainMemberName; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesDelete(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainTransactionNode_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs new file mode 100644 index 000000000000..86785eda5812 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs @@ -0,0 +1,398 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete the transaction node. + /// + /// [OpenAPI] TransactionNodes_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainTransactionNode_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainTransactionNode_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainTransactionNode_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainTransactionNode_DeleteViaIdentity Clone() + { + var clone = new RemoveAzBlockchainTransactionNode_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesDelete(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainTransactionNode_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs b/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs new file mode 100644 index 000000000000..614be8513e43 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs @@ -0,0 +1,363 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// To check whether a resource name is available. + /// + /// [OpenAPI] Locations_CheckNameAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/checkNameAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzBlockchainLocationNameAvailability_CheckExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"To check whether a resource name is available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class TestAzBlockchainLocationNameAvailability_CheckExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// Location Name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Location Name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Gets or sets the name to check. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the name to check.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name to check.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string Name { get => NameAvailabilityRequestBody.Name ?? null; set => NameAvailabilityRequestBody.Name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest _nameAvailabilityRequestBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest(); + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest NameAvailabilityRequestBody { get => this._nameAvailabilityRequestBody; set => this._nameAvailabilityRequestBody = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the type of the resource to check. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the type of the resource to check.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of the resource to check.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string Type { get => NameAvailabilityRequestBody.Type ?? null; set => NameAvailabilityRequestBody.Type = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LocationsCheckNameAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsCheckNameAvailability(Location, SubscriptionId, NameAvailabilityRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Location=Location,SubscriptionId=SubscriptionId,body=NameAvailabilityRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzBlockchainLocationNameAvailability_CheckExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs new file mode 100644 index 000000000000..3b0df63debc2 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs @@ -0,0 +1,408 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainMember_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainMember_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdate(); + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersUpdate(Name, SubscriptionId, ResourceGroupName, BlockchainMemberBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainMember_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..67595a9ddb52 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs @@ -0,0 +1,383 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainMember_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainMember_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdate(); + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersUpdateViaIdentity(InputObject.Id, BlockchainMemberBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersUpdate(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, BlockchainMemberBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainMember_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs new file mode 100644 index 000000000000..6835daad7e4a --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs @@ -0,0 +1,397 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainTransactionNode_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainTransactionNode_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeUpdate(); + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesUpdate(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, TransactionNodeBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainTransactionNode_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..bfa7e68d8b72 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs @@ -0,0 +1,362 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainTransactionNode_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeUpdate(); + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesUpdateViaIdentity(InputObject.Id, TransactionNodeBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesUpdate(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, TransactionNodeBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs b/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..a56db88ef37c --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,828 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncJob.cs b/src/Blockchain/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..9fac2484960e --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncOperationResponse.cs b/src/Blockchain/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..313b3cd75178 --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..8d5a5547be8d --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..1e1e81211002 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..e708b4f659f6 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support"; + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!IsAzure || pf.Property.Name != "Id") + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..4b9fc4f118ee --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..62eec8d62fc8 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..b88d4ac2595a --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append(@" +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +"); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } catch (Exception ee) { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..3100e4cf9c03 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,125 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.Blockchain.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: Blockchain cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.Blockchain.private.dll"}'"); + + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.Blockchain.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Blockchain".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..5100a4dfb707 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,137 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine(@"$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath)" +); + sb.AppendLine($@"$TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@"$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName +"); + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..57b22df4e269 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..71ea6485253b --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..cf81e631a092 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..363c598724ce --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..0b3b3f9d92e6 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + if (markdownInfo.SupportsPaging) + { + foreach (var parameter in SupportsPagingParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"### {alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..f8173919e24f --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..e4b2d2cccb80 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name} +{ExampleCodeHeader} +{ExampleInfo.Code} +{ExampleCodeFooter} + +{ExampleInfo.Description.ToDescriptionFormat()} + +"; + } + + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Description.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..9cd34da5c98c --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..a73ef6b3d7aa --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,291 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (codeEndIndex ?? 0) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + if (Variant.SupportsPaging) + { + parameterStrings = parameterStrings.Append(" [-First ]").Append(" [-IncludeTotalCount]").Append(" [-Skip ]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string description) + { + Name = name; + Code = code; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}") + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..8b2c520c5407 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,513 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BeginOutput + { + public VariantGroup VariantGroup { get; } + + public BeginOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput + { + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + } + + internal class EndOutput + { + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new [] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new []{"
", "\r\n", "\n"}); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..1311e5e69110 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,499 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{variantGroup.ModuleName.ToLowerInvariant()}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => !ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)); + } + return parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))).ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs b/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..532c2eb6e10f --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..df134e8ba5e1 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,160 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs b/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..0b8bec2a2a98 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..eb989e746276 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..ca0d54aa0a71 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/Blockchain/generated/runtime/CmdInfoHandler.cs b/src/Blockchain/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..ee2317f1e1a8 --- /dev/null +++ b/src/Blockchain/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/Blockchain/generated/runtime/Conversions/ConversionException.cs b/src/Blockchain/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..a1c972846b81 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs b/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..5e3e10073e47 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..23338b020e0c --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..af1dd3e7f537 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..b069041ba390 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..804b6f52f58c --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..577cf54f565e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..f37267b29f8e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..2cca6e9c2dae --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..cee49ddce024 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..403720502e3e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..c2a466bea985 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..54ff49040c0d --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..43f7e415d8df --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..a6460faebb88 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..6699a3820d3e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..a41ebe92bcf0 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..5cdb5ddfa738 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..f60212c88305 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..2acaa95bdd2d --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..3851b380815a --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..5bb226066383 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..7a89b9d61377 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..8dbbd5063902 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..07fa244d5019 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..9a9053a3ba4e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs b/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..084e57cad175 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs b/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..cd27fe7c82e3 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,249 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonArray.cs b/src/Blockchain/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..c91418dd8091 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs b/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..67a5d6aba5c9 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonNode.cs b/src/Blockchain/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..f8a634111ee2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs b/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..aafbf0bb59db --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonObject.cs b/src/Blockchain/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..012e4e2de0bb --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonString.cs b/src/Blockchain/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..8788e8f6d0db --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs b/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..9c41283abb78 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Debugging.cs b/src/Blockchain/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..d29770aa4f8c --- /dev/null +++ b/src/Blockchain/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/Blockchain/generated/runtime/DictionaryExtensions.cs b/src/Blockchain/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..2c553bcbab71 --- /dev/null +++ b/src/Blockchain/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + if (value is System.Collections.Hashtable nested) + { + HashTableToDictionary(nested, new System.Collections.Generic.Dictionary()); + } + else + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventData.cs b/src/Blockchain/generated/runtime/EventData.cs new file mode 100644 index 000000000000..a8912d03fc83 --- /dev/null +++ b/src/Blockchain/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventDataExtensions.cs b/src/Blockchain/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..d62dad4a611d --- /dev/null +++ b/src/Blockchain/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventListener.cs b/src/Blockchain/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..c636a4061ee8 --- /dev/null +++ b/src/Blockchain/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Events.cs b/src/Blockchain/generated/runtime/Events.cs new file mode 100644 index 000000000000..85151928d343 --- /dev/null +++ b/src/Blockchain/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventsExtensions.cs b/src/Blockchain/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..9b3353b7ca4f --- /dev/null +++ b/src/Blockchain/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Extensions.cs b/src/Blockchain/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..26c4863f35e1 --- /dev/null +++ b/src/Blockchain/generated/runtime/Extensions.cs @@ -0,0 +1,111 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Linq; + + internal static partial class Extensions + { + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => headerName == each.Key).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..c6bc29891e3d --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..e4569b52ac39 --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Seperator.cs b/src/Blockchain/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..3799307a4fde --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs b/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..1f86c3ab3e75 --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/XHelper.cs b/src/Blockchain/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..84f3d468147a --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/HttpPipeline.cs b/src/Blockchain/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..762fcc410bb4 --- /dev/null +++ b/src/Blockchain/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 b/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..0f2720f65393 --- /dev/null +++ b/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/Blockchain/generated/runtime/IAssociativeArray.cs b/src/Blockchain/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..2cc57d303db9 --- /dev/null +++ b/src/Blockchain/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + int Count { get; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/IHeaderSerializable.cs b/src/Blockchain/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..564fb335e326 --- /dev/null +++ b/src/Blockchain/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/ISendAsync.cs b/src/Blockchain/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..30d2d04378c3 --- /dev/null +++ b/src/Blockchain/generated/runtime/ISendAsync.cs @@ -0,0 +1,289 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/InfoAttribute.cs b/src/Blockchain/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..e3865b8c277f --- /dev/null +++ b/src/Blockchain/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Iso/IsoDate.cs b/src/Blockchain/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..0435ee7ea539 --- /dev/null +++ b/src/Blockchain/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/Blockchain/generated/runtime/JsonType.cs b/src/Blockchain/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..ad4504f3906d --- /dev/null +++ b/src/Blockchain/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Method.cs b/src/Blockchain/generated/runtime/Method.cs new file mode 100644 index 000000000000..94711006defb --- /dev/null +++ b/src/Blockchain/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonMember.cs b/src/Blockchain/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..cbc03c80024d --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonModel.cs b/src/Blockchain/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..846d8f86b664 --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonModelCache.cs b/src/Blockchain/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..14db689c98d1 --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..bcf1dac2b273 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..699c47bf11a5 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..6de896830847 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..e1285366c4d2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..9e02735db5c2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs b/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..8e94af702738 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonDate.cs b/src/Blockchain/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..a0f2e8cbb0e5 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonNode.cs b/src/Blockchain/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..31ecd7d0c830 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs b/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..5e7e87609d3c --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonObject.cs b/src/Blockchain/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..04ccd1a46db2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonString.cs b/src/Blockchain/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..671aa874d383 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/XBinary.cs b/src/Blockchain/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..078e2a22b2f7 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/XNull.cs b/src/Blockchain/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..f7617e952edb --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs b/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..49b40c3651e4 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonParser.cs b/src/Blockchain/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..7a4529ff8aee --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonToken.cs b/src/Blockchain/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..cbb139fc7cc9 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs b/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..1aa8f4c88b6e --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Location.cs b/src/Blockchain/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..0cd69feb7107 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs b/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..fd4d1b2c3470 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/TokenReader.cs b/src/Blockchain/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..e7019a344485 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/PipelineMocking.cs b/src/Blockchain/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..0ba845d2b51b --- /dev/null +++ b/src/Blockchain/generated/runtime/PipelineMocking.cs @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result); + + internal static JsonNode SerializeContent(byte[] content) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (content.EndsWith("==")) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content) }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content) }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"))) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"))) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Response.cs b/src/Blockchain/generated/runtime/Response.cs new file mode 100644 index 000000000000..37df09e5a3a7 --- /dev/null +++ b/src/Blockchain/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs b/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..48c85c8aeee3 --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs b/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..07fb4dfc3486 --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs b/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..4eda48e9d4ef --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/SerializationMode.cs b/src/Blockchain/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..17084e1bcd6b --- /dev/null +++ b/src/Blockchain/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/TypeConverterExtensions.cs b/src/Blockchain/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..c7a627965d74 --- /dev/null +++ b/src/Blockchain/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,190 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + } +} diff --git a/src/Blockchain/generated/runtime/UndeclaredResponseException.cs b/src/Blockchain/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..c60508154566 --- /dev/null +++ b/src/Blockchain/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject; + + // see if there is an error block in the body + json = json.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // we'll create one below. + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Writers/JsonWriter.cs b/src/Blockchain/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..eba0411bb174 --- /dev/null +++ b/src/Blockchain/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/Blockchain/generated/runtime/delegates.cs b/src/Blockchain/generated/runtime/delegates.cs new file mode 100644 index 000000000000..c098da3eb8bb --- /dev/null +++ b/src/Blockchain/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/Blockchain/help/Az.Blockchain.md b/src/Blockchain/help/Az.Blockchain.md new file mode 100644 index 000000000000..a857ee900620 --- /dev/null +++ b/src/Blockchain/help/Az.Blockchain.md @@ -0,0 +1,61 @@ +--- +Module Name: Az.Blockchain +Module Guid: ae1a09bf-916c-480c-a1bb-bace1453a91e +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.blockchain +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Blockchain Module +## Description +Microsoft Azure PowerShell: Blockchain cmdlets + +## Az.Blockchain Cmdlets +### [Get-AzBlockchainConsortium](Get-AzBlockchainConsortium.md) +Lists the available consortiums for a subscription. + +### [Get-AzBlockchainMember](Get-AzBlockchainMember.md) +Get details about a blockchain member. + +### [Get-AzBlockchainMemberApiKey](Get-AzBlockchainMemberApiKey.md) +Lists the API keys for a blockchain member. + +### [Get-AzBlockchainMemberConsortiumMember](Get-AzBlockchainMemberConsortiumMember.md) +Lists the consortium members for a blockchain member. + +### [Get-AzBlockchainSku](Get-AzBlockchainSku.md) +Lists the Skus of the resource type. + +### [Get-AzBlockchainTransactionNode](Get-AzBlockchainTransactionNode.md) +Get the details of the transaction node. + +### [Get-AzBlockchainTransactionNodeApiKey](Get-AzBlockchainTransactionNodeApiKey.md) +List the API keys for the transaction node. + +### [New-AzBlockchainMember](New-AzBlockchainMember.md) +Create a blockchain member. + +### [New-AzBlockchainMemberApiKey](New-AzBlockchainMemberApiKey.md) +Regenerate the API keys for a blockchain member. + +### [New-AzBlockchainTransactionNode](New-AzBlockchainTransactionNode.md) +Create or update the transaction node. + +### [New-AzBlockchainTransactionNodeApiKey](New-AzBlockchainTransactionNodeApiKey.md) +Regenerate the API keys for the blockchain member. + +### [Remove-AzBlockchainMember](Remove-AzBlockchainMember.md) +Delete a blockchain member. + +### [Remove-AzBlockchainTransactionNode](Remove-AzBlockchainTransactionNode.md) +Delete the transaction node. + +### [Test-AzBlockchainLocationNameAvailability](Test-AzBlockchainLocationNameAvailability.md) +To check whether a resource name is available. + +### [Update-AzBlockchainMember](Update-AzBlockchainMember.md) +Update a blockchain member. + +### [Update-AzBlockchainTransactionNode](Update-AzBlockchainTransactionNode.md) +Update the transaction node. + diff --git a/src/Blockchain/help/Get-AzBlockchainConsortium.md b/src/Blockchain/help/Get-AzBlockchainConsortium.md new file mode 100644 index 000000000000..30c9982f4e7e --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainConsortium.md @@ -0,0 +1,126 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +schema: 2.0.0 +--- + +# Get-AzBlockchainConsortium + +## SYNOPSIS +Lists the available consortiums for a subscription. + +## SYNTAX + +``` +Get-AzBlockchainConsortium -Location [-SubscriptionId ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Lists the available consortiums for a subscription. + +## EXAMPLES + +### Example 1: Get Blockchain consortiums. +```powershell +PS C:\> Get-AzBlockchainConsortium -Location eastus + +``` + +This command lists the consortiums under a subscription for a specific location. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMember.md b/src/Blockchain/help/Get-AzBlockchainMember.md new file mode 100644 index 000000000000..e5a056066e79 --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMember.md @@ -0,0 +1,201 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +schema: 2.0.0 +--- + +# Get-AzBlockchainMember + +## SYNOPSIS +Get details about a blockchain member. + +## SYNTAX + +### List1 (Default) +``` +Get-AzBlockchainMember [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzBlockchainMember -InputObject [-DefaultProfile ] [] +``` + +### List +``` +Get-AzBlockchainMember -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get details about a blockchain member. + +## EXAMPLES + +### Example 1: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a subscription. + +### Example 2: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a resource group. + +### Example 3: Get a blockchain member +```powershell +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +### Example 4: Get a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName lucas-blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md b/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..c1b8c31f0e4d --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md @@ -0,0 +1,146 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +schema: 2.0.0 +--- + +# Get-AzBlockchainMemberApiKey + +## SYNOPSIS +Lists the API keys for a blockchain member. + +## SYNTAX + +``` +Get-AzBlockchainMemberApiKey -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Lists the API keys for a blockchain member. + +## EXAMPLES + +### Example 1: List blockchain Api keys +```powershell +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command lists Api keys for a blockchain member. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md b/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md new file mode 100644 index 000000000000..506848d9bef3 --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md @@ -0,0 +1,114 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +schema: 2.0.0 +--- + +# Get-AzBlockchainMemberConsortiumMember + +## SYNOPSIS +Lists the consortium members for a blockchain member. + +## SYNTAX + +``` +Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the consortium members for a blockchain member. + +## EXAMPLES + +### Example 1: Lists the consortium members for a blockchain member. +```powershell +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb +``` + +This command lists the consortium members for a blockchain member. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainSku.md b/src/Blockchain/help/Get-AzBlockchainSku.md new file mode 100644 index 000000000000..15652df8229d --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainSku.md @@ -0,0 +1,79 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +schema: 2.0.0 +--- + +# Get-AzBlockchainSku + +## SYNOPSIS +Lists the Skus of the resource type. + +## SYNTAX + +``` +Get-AzBlockchainSku [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the Skus of the resource type. + +## EXAMPLES + +### Example 1: List SKU for a subscription +```powershell +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + +``` + +This command lists SKU for a subscription. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainTransactionNode.md b/src/Blockchain/help/Get-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..02754d61927a --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainTransactionNode.md @@ -0,0 +1,197 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Get-AzBlockchainTransactionNode + +## SYNOPSIS +Get the details of the transaction node. + +## SYNTAX + +### List (Default) +``` +Get-AzBlockchainTransactionNode -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzBlockchainTransactionNode -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the details of the transaction node. + +## EXAMPLES + +### Example 1: List transaction nodes for a blockchain member +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command lists transaction nodes for a blockchain member. + +### Example 2: Get a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +### Example 3: Get a transaction node +```powershell +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..381dd3cafe80 --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,162 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +schema: 2.0.0 +--- + +# Get-AzBlockchainTransactionNodeApiKey + +## SYNOPSIS +List the API keys for the transaction node. + +## SYNTAX + +``` +Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName -ResourceGroupName + -TransactionNodeName [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +List the API keys for the transaction node. + +## EXAMPLES + +### Example 1: List Api keys for a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command lists Api keys for a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TransactionNodeName +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainMember.md b/src/Blockchain/help/New-AzBlockchainMember.md new file mode 100644 index 000000000000..9b920098d6d7 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainMember.md @@ -0,0 +1,372 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +schema: 2.0.0 +--- + +# New-AzBlockchainMember + +## SYNOPSIS +Create a blockchain member. + +## SYNTAX + +``` +New-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-Consortium ] [-ConsortiumManagementAccountPassword ] + [-ConsortiumMemberDisplayName ] [-ConsortiumRole ] [-FirewallRule ] + [-Location ] [-Password ] [-Protocol ] [-Sku ] + [-SkuTier ] [-Tag ] [-ValidatorNodeSkuCapacity ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create a blockchain member. + +## EXAMPLES + +### Example 1: Create a new blockchain member +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command creates a new blockchain member. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Consortium +Gets or sets the consortium for the blockchain member. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumManagementAccountPassword +Sets the managed consortium management account password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumMemberDisplayName +Gets the display name of the member in the consortium. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumRole +Gets the role of the member in the consortium. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets firewall rules +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The GEO location of the blockchain service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the basic auth password of the blockchain member. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Protocol +Gets or sets the blockchain protocol. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +Gets or sets Sku name + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkuTier +Gets or sets Sku tier + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Tags of the service which is a list of key value pairs that describes the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ValidatorNodeSkuCapacity +Gets or sets the nodes capacity. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets firewall rules + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainMemberApiKey.md b/src/Blockchain/help/New-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..ea1471a75854 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainMemberApiKey.md @@ -0,0 +1,231 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +schema: 2.0.0 +--- + +# New-AzBlockchainMemberApiKey + +## SYNOPSIS +Regenerate the API keys for a blockchain member. + +## SYNTAX + +### RegenerateExpanded (Default) +``` +New-AzBlockchainMemberApiKey -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-KeyName ] [-Value ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### RegenerateViaIdentityExpanded +``` +New-AzBlockchainMemberApiKey -InputObject [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Regenerate the API keys for a blockchain member. + +## EXAMPLES + +### Example 1: Regenerate Api keys for a blockchain member +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member. + +### Example 1: Regenerate Api keys for a blockchain member +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName lucas-bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: RegenerateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyName +Gets or sets the API key name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Gets or sets the API key value. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainTransactionNode.md b/src/Blockchain/help/New-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..149cfbd05b69 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainTransactionNode.md @@ -0,0 +1,248 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +schema: 2.0.0 +--- + +# New-AzBlockchainTransactionNode + +## SYNOPSIS +Create or update the transaction node. + +## SYNTAX + +``` +New-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-FirewallRule ] [-Location ] [-Password ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create or update the transaction node. + +## EXAMPLES + +### Example 1: Create a blockchain transaction node +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command creates a blockchain transaction node. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Gets or sets the transaction node location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..2d1c8da791e7 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,246 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +schema: 2.0.0 +--- + +# New-AzBlockchainTransactionNodeApiKey + +## SYNOPSIS +Regenerate the API keys for the blockchain member. + +## SYNTAX + +### RegenerateExpanded (Default) +``` +New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName -ResourceGroupName + -TransactionNodeName [-SubscriptionId ] [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### RegenerateViaIdentityExpanded +``` +New-AzBlockchainTransactionNodeApiKey -InputObject [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Regenerate the API keys for the blockchain member. + +## EXAMPLES + +### Example 1: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node. + +### Example 2: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: RegenerateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyName +Gets or sets the API key name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TransactionNodeName +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Gets or sets the API key value. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Remove-AzBlockchainMember.md b/src/Blockchain/help/Remove-AzBlockchainMember.md new file mode 100644 index 000000000000..2b92b137a584 --- /dev/null +++ b/src/Blockchain/help/Remove-AzBlockchainMember.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +schema: 2.0.0 +--- + +# Remove-AzBlockchainMember + +## SYNOPSIS +Delete a blockchain member. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzBlockchainMember -InputObject [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete a blockchain member. + +## EXAMPLES + +### Example 1: Remove a blockchain member +```powershell +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +``` + +This command removes a blockchain member. + +### Example 2: Remove a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + +``` + +This command removes a blockchain member. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md b/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..6fe17e1154a2 --- /dev/null +++ b/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Remove-AzBlockchainTransactionNode + +## SYNOPSIS +Delete the transaction node. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzBlockchainTransactionNode -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete the transaction node. + +## EXAMPLES + +### Example 1: Remove a transaction node +```powershell +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +``` + +This command removes a transaction node. + +### Example 2: Remove a transaction node +```powershell +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node +``` + +This command removes a transaction node. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md b/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md new file mode 100644 index 000000000000..e47d13dc95e0 --- /dev/null +++ b/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md @@ -0,0 +1,170 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +schema: 2.0.0 +--- + +# Test-AzBlockchainLocationNameAvailability + +## SYNOPSIS +To check whether a resource name is available. + +## SYNTAX + +``` +Test-AzBlockchainLocationNameAvailability -Location [-SubscriptionId ] [-Name ] + [-Type ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +To check whether a resource name is available. + +## EXAMPLES + +### Example 1: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +``` + +The command checks whether a resource name is available. + +### Example 2: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid +``` + +The command checks whether a resource name is available. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Gets or sets the name to check. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +Gets or sets the type of the resource to check. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Update-AzBlockchainMember.md b/src/Blockchain/help/Update-AzBlockchainMember.md new file mode 100644 index 000000000000..412fa0bed850 --- /dev/null +++ b/src/Blockchain/help/Update-AzBlockchainMember.md @@ -0,0 +1,268 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +schema: 2.0.0 +--- + +# Update-AzBlockchainMember + +## SYNOPSIS +Update a blockchain member. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-ConsortiumManagementAccountPassword ] [-FirewallRule ] + [-Password ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzBlockchainMember -InputObject + [-ConsortiumManagementAccountPassword ] [-FirewallRule ] + [-Password ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Update a blockchain member. + +## EXAMPLES + +### Example 1: Update a blockchain member +```powershell +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +### Example 2: Update a blockchain member +```powershell +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +## PARAMETERS + +### -ConsortiumManagementAccountPassword +Sets the managed consortium management account password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Tags of the service which is a list of key value pairs that describes the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Update-AzBlockchainTransactionNode.md b/src/Blockchain/help/Update-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..3b2094ec4c8c --- /dev/null +++ b/src/Blockchain/help/Update-AzBlockchainTransactionNode.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Update-AzBlockchainTransactionNode + +## SYNOPSIS +Update the transaction node. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-FirewallRule ] [-Password ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzBlockchainTransactionNode -InputObject [-FirewallRule ] + [-Password ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update the transaction node. + +## EXAMPLES + +### Example 1: Update a transcation node +```powershell +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +### Example 2: Update a transcation node +```powershell +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/how-to.md b/src/Blockchain/how-to.md new file mode 100644 index 000000000000..e939c07b9e49 --- /dev/null +++ b/src/Blockchain/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.Blockchain`. + +## Building `Az.Blockchain` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. + +## Testing `Az.Blockchain` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. + +## Packing `Az.Blockchain` +To pack `Az.Blockchain` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.Blockchain`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.Blockchain.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Blockchain.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.Blockchain`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.Blockchain` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/Blockchain/internal/Az.Blockchain.internal.psm1 b/src/Blockchain/internal/Az.Blockchain.internal.psm1 new file mode 100644 index 000000000000..4c9927e3fa9f --- /dev/null +++ b/src/Blockchain/internal/Az.Blockchain.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Blockchain.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 b/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 new file mode 100644 index 000000000000..5e5fbc4e6abc --- /dev/null +++ b/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 @@ -0,0 +1,121 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available operations of Microsoft.Blockchain resource provider. +.Description +Lists the available operations of Microsoft.Blockchain resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainoperation +#> +function Get-AzBlockchainOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/New-AzBlockchainMember.ps1 b/src/Blockchain/internal/New-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..047bfc392a13 --- /dev/null +++ b/src/Blockchain/internal/New-AzBlockchainMember.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${SkuName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainMember_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..ef880d4edb3d --- /dev/null +++ b/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNode_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 b/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..67fda322050e --- /dev/null +++ b/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,961 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available operations of Microsoft.Blockchain resource provider. +.Description +Lists the available operations of Microsoft.Blockchain resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainoperation +#> +function Get-AzBlockchainOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${SkuName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainMember_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNode_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/Update-AzBlockchainMember.ps1 b/src/Blockchain/internal/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..447574250ef3 --- /dev/null +++ b/src/Blockchain/internal/Update-AzBlockchainMember.ps1 @@ -0,0 +1,207 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..6a9853daf5a0 --- /dev/null +++ b/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/readme.md b/src/Blockchain/internal/readme.md new file mode 100644 index 000000000000..cd05b500991f --- /dev/null +++ b/src/Blockchain/internal/readme.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.Blockchain.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Blockchain`. Instead, this sub-module is imported by the `..\custom\Az.Blockchain.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Blockchain.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Blockchain`. \ No newline at end of file diff --git a/src/Blockchain/pack-module.ps1 b/src/Blockchain/pack-module.ps1 new file mode 100644 index 000000000000..c22fad33d87b --- /dev/null +++ b/src/Blockchain/pack-module.ps1 @@ -0,0 +1,16 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/readme.md b/src/Blockchain/readme.md new file mode 100644 index 000000000000..aeec4b30d625 --- /dev/null +++ b/src/Blockchain/readme.md @@ -0,0 +1,121 @@ + +# Az.Blockchain +This directory contains the PowerShell module for the Blockchain service. + +--- +## Status +[![Az.Blockchain](https://img.shields.io/powershellgallery/v/Az.Blockchain.svg?style=flat-square&label=Az.Blockchain "Az.Blockchain")](https://www.powershellgallery.com/packages/Az.Blockchain/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.7.4 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.Blockchain`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/blockchain/resource-manager/Microsoft.Blockchain/preview/2018-06-01-preview/blockchain.json +module-version: 0.1.0 +title: Blockchain +subject-prefix: 'Blockchain' + +identity-correction-for-post: true + +directive: + - from: swagger-document + where: $.paths..operationId + transform: return $.replace(/ListRegenerateApiKeys$/, "RegenerateApiKeys") + - from: swagger-document + where: $ + transform: return $.replace(/locationName/g, "location") + - where: + subject: Operation + hide: true + - where: + subject: LocationConsortium + set: + subject: Consortium + - where: + subject: BlockchainMemberOperationResult + remove: true + # Should use verb 'New' for the two RegenateApiKey related APIs + - where: + subject: BlockchainMemberRegenerateApiKey + verb: Get + set: + verb: New + subject: BlockchainMemberApiKey + - where: + subject: TransactionNodeRegenerateApiKey + verb: Get + set: + verb: New + subject: TransactionNodeApiKey + # Drop the un-flattened parameter-set for Post/New/Set/Update related cmdlets. + - where: + subject: (.*)RegenerateApiKey$ + variant: List + remove: true + - where: + verb: Update + variant: ^Update$|^UpdateViaIdentity$ + remove: true + - where: + verb: New + variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Regenerate$|^RegenerateViaIdentity$ + remove: true + - where: + verb: Test + variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$ + remove: true + # Hide these two cmdlets, because we need to customize a version with password secured. + - where: + verb: New|Update + subject: BlockchainMember + hide: true + - where: + verb: New|Update + subject: TransactionNode + hide: true + - where: + parameter-name: SubscriptionId + set: + default: + script: '(Get-AzContext).Subscription.Id' +``` diff --git a/src/Blockchain/run-module.ps1 b/src/Blockchain/run-module.ps1 new file mode 100644 index 000000000000..60d6a5e46f22 --- /dev/null +++ b/src/Blockchain/run-module.ps1 @@ -0,0 +1,59 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/Blockchain/test-module.ps1 b/src/Blockchain/test-module.ps1 new file mode 100644 index 000000000000..6578dd134116 --- /dev/null +++ b/src/Blockchain/test-module.ps1 @@ -0,0 +1,68 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) { + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +if($Live) { + $TestMode = 'live' +} +if($Record) { + $TestMode = 'record' +} +try { + if ($TestMode -ne 'playback') { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + Invoke-Pester -Script @{ Path = $testFolder } -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") +} +Finally +{ + if ($TestMode -ne 'playback') { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json b/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json new file mode 100644 index 000000000000..fae862e45ad2 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainConsortium+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/listConsortiums?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/listConsortiums?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "59" ], + "x-ms-client-request-id": [ "de3d67c8-b4cf-45fe-a5b5-fac7405920c9" ], + "CommandName": [ "Get-AzBlockchainConsortium" ], + "FullCommandName": [ "Get-AzBlockchainConsortium_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "x-ms-correlation-request-id": [ "0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141125Z:0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "Date": [ "Thu, 21 May 2020 14:11:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 new file mode 100644 index 000000000000..fa1bb2a4bf09 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 @@ -0,0 +1,20 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainConsortium.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainConsortium' { + It 'List' { + { + Get-AzBlockchainConsortium -Location eastus + } | Should -Not -Throw + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMember.Recording.json b/src/Blockchain/test/Get-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..b77a4be410b9 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMember.Recording.json @@ -0,0 +1,197 @@ +{ + "Get-AzBlockchainMember+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "6a553666-87b0-4286-8fad-c0a2f834376c" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11946" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "x-ms-correlation-request-id": [ "5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141126Z:5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "Date": [ "Thu, 21 May 2020 14:11:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2834" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainue7wvy\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainue7wvy\",\"password\":null,\"consortium\":\"consortiumue7wvy\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainue7wvy\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"RgNFxaESsjuCJSZ+IYW1/LBLMmV8J1C7F1wlxcqXNFE=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainue7wvy.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroupue7wvy/providers/Microsoft.Blockchain/blockchainMembers/myblockchainue7wvy\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Get-AzBlockchainMember+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "61" ], + "x-ms-client-request-id": [ "8a76e9f3-4875-4edd-9036-c07c34e59eca" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11945" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "x-ms-correlation-request-id": [ "14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141126Z:14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Get-AzBlockchainMember+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "62" ], + "x-ms-client-request-id": [ "ea6cf138-803b-4d6c-910d-8d3705a59c0b" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11944" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "x-ms-correlation-request-id": [ "754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141127Z:754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1893" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Get-AzBlockchainMember+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "63" ], + "x-ms-client-request-id": [ "c4bd0719-007e-4da3-98d6-e9cd363d9c05" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11943" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "x-ms-correlation-request-id": [ "21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141127Z:21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Get-AzBlockchainMember+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "64" ], + "x-ms-client-request-id": [ "c1eeb01f-9a84-44da-a48f-03e54c5d57cf" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11942" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "152aa32a-03b8-4847-9646-a944d6acbe77" ], + "x-ms-correlation-request-id": [ "152aa32a-03b8-4847-9646-a944d6acbe77" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141128Z:152aa32a-03b8-4847-9646-a944d6acbe77" ], + "Date": [ "Thu, 21 May 2020 14:11:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..88ca3f3673c7 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,37 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMember' { + It 'List1' { + $bcMember = Get-AzBlockchainMember + $bcMember.Count | Should -BeGreaterOrEqual 2 + } + + It 'Get' { + $bcMember = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $bcMember.Name | Should -Be $env.blockchainMember + } + + It 'List' { + $bcMember = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMember.Count | Should -Be 2 + } + + It 'GetViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $member = Get-AzBlockchainMember -SubscriptionId $env.SubscriptionId -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $bcMember = Get-AzBlockchainMember -InputObject $member + $bcMember.Name | Should -Be $env.blockchainMember + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json new file mode 100644 index 000000000000..b96d81ff0ea9 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainMemberApiKey+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "65" ], + "x-ms-client-request-id": [ "57e46b19-0650-4b06-b986-6cb36251a29b" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "x-ms-correlation-request-id": [ "13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141128Z:13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "Date": [ "Thu, 21 May 2020 14:11:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"8y6u3WirRR8jx1I25vLPYgvY\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 new file mode 100644 index 000000000000..17e017a00941 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMemberApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMemberApiKey' { + It 'List' { + $memberKeys = Get-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $memberKeys.Count | Should -Be 2 + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json new file mode 100644 index 000000000000..9f6cc603a1a8 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainMemberConsortiumMember+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/consortiumMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/consortiumMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "66" ], + "x-ms-client-request-id": [ "63ca3930-3b59-4e9d-90ed-730e5062d205" ], + "CommandName": [ "Get-AzBlockchainMemberConsortiumMember" ], + "FullCommandName": [ "Get-AzBlockchainMemberConsortiumMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11941" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "x-ms-correlation-request-id": [ "1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141129Z:1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "Date": [ "Thu, 21 May 2020 14:11:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "243" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"name\":\"myblockchainhv0x8n\",\"displayName\":\"myblockchainhv0x8n\",\"subscriptionId\":\"9e223dbe-3399-4e19-88eb-0975f02ac87f\",\"role\":\"ADMIN\",\"status\":\"Ready\",\"joinDate\":\"2020-05-21T13:46:13.0148402Z\",\"dateModified\":\"2020-05-21T13:54:40\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 new file mode 100644 index 000000000000..5e2bb996b7b0 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMemberConsortiumMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMemberConsortiumMember' { + It 'List' { + $consortiums = Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $consortiums.Count | Should -Be 1 + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainSku.Recording.json b/src/Blockchain/test/Get-AzBlockchainSku.Recording.json new file mode 100644 index 000000000000..5726a9136439 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainSku.Recording.json @@ -0,0 +1,40 @@ +{ + "Get-AzBlockchainSku+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/skus?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/skus?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "67" ], + "x-ms-client-request-id": [ "8d513b78-7fd1-4e98-afda-8b153bc37747" ], + "CommandName": [ "Get-AzBlockchainSku" ], + "FullCommandName": [ "Get-AzBlockchainSku_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11940" ], + "x-ms-request-id": [ "e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "x-ms-correlation-request-id": [ "e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141129Z:e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "12" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 new file mode 100644 index 000000000000..53898fe63f48 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainSku.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainSku' { + It 'List' { + { Get-AzBlockchainSku } | Should -Not -Throw + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..5d3ce12aa3f5 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzBlockchainTransactionNode+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "68" ], + "x-ms-client-request-id": [ "436a30cc-3a00-4fdb-b423-678fe3b3bcd2" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11939" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "x-ms-correlation-request-id": [ "ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141130Z:ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1283" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"}]}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "69" ], + "x-ms-client-request-id": [ "ee38d7c5-9cba-420a-9ea2-ad437d3c66ce" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11938" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "x-ms-correlation-request-id": [ "c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141130Z:c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "70" ], + "x-ms-client-request-id": [ "f2d04a8c-fa5e-40cb-b0c9-69412caf4707" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11937" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "x-ms-correlation-request-id": [ "afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141131Z:afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "Date": [ "Thu, 21 May 2020 14:11:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "71" ], + "x-ms-client-request-id": [ "48ecf3d0-23c6-4f08-b35d-3142f5ff4099" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11936" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "15367c70-b16a-4e4d-85ab-87683991843e" ], + "x-ms-correlation-request-id": [ "15367c70-b16a-4e4d-85ab-87683991843e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141131Z:15367c70-b16a-4e4d-85ab-87683991843e" ], + "Date": [ "Thu, 21 May 2020 14:11:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..e873f529ba32 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainTransactionNode' { + It 'List' { + $tNodes = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodes.Count | Should -Be 2 + } + + It 'Get' { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + $tNode.Name | Should -Be $env.blockchainTransactionNode + } + + It 'GetViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + $tNode = Get-AzBlockchainTransactionNode -InputObject $tNode + $tNode.Name | Should -Be $env.blockchainTransactionNode + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json new file mode 100644 index 000000000000..83bbda48db7c --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainTransactionNodeApiKey+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "72" ], + "x-ms-client-request-id": [ "f748e0cd-b745-4926-9871-f4e053d8cc25" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "x-ms-correlation-request-id": [ "5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141132Z:5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "Date": [ "Thu, 21 May 2020 14:11:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"HvMwIKaC9H5KSiWnEieqsDad\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 new file mode 100644 index 000000000000..4a7426eb709e --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainTransactionNodeApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainTransactionNodeApiKey' { + It 'List' { + $tNodeKeys = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + $tNodeKeys.Count | Should -Be 2 + } +} diff --git a/src/Blockchain/test/New-AzBlockchainMember.Recording.json b/src/Blockchain/test/New-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..25981b66dfce --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMember.Recording.json @@ -0,0 +1,660 @@ +{ + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": "{\n \"location\": \"eastus\",\n \"properties\": {\n \"consortium\": \"PowershellConsortiumNamel9b8e0\",\n \"consortiumManagementAccountPassword\": \"strongConsortiumManagementPassword@1\",\n \"password\": \"strongMemberAccountPassword@1\",\n \"protocol\": \"Quorum\"\n },\n \"sku\": {\n \"name\": \"S0\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "291" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "x-ms-correlation-request-id": [ "68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141139Z:68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "Date": [ "Thu, 21 May 2020 14:11:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "811" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11935" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "x-ms-correlation-request-id": [ "e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141210Z:e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "Date": [ "Thu, 21 May 2020 14:12:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11934" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3d5eca19-701b-4652-821b-647e13be2e30" ], + "x-ms-correlation-request-id": [ "3d5eca19-701b-4652-821b-647e13be2e30" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141240Z:3d5eca19-701b-4652-821b-647e13be2e30" ], + "Date": [ "Thu, 21 May 2020 14:12:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11933" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9c735539-5534-4155-9ff1-86b09cb22135" ], + "x-ms-correlation-request-id": [ "9c735539-5534-4155-9ff1-86b09cb22135" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141310Z:9c735539-5534-4155-9ff1-86b09cb22135" ], + "Date": [ "Thu, 21 May 2020 14:13:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11932" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "x-ms-correlation-request-id": [ "d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141341Z:d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "Date": [ "Thu, 21 May 2020 14:13:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11931" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "x-ms-correlation-request-id": [ "3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141411Z:3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "Date": [ "Thu, 21 May 2020 14:14:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11930" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "x-ms-correlation-request-id": [ "9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141441Z:9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "Date": [ "Thu, 21 May 2020 14:14:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11929" ], + "x-ms-request-id": [ "7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141512Z:7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "Date": [ "Thu, 21 May 2020 14:15:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11928" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "x-ms-correlation-request-id": [ "623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141543Z:623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "Date": [ "Thu, 21 May 2020 14:15:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11927" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "dc2f9925-be87-437c-8f62-38625d9fda09" ], + "x-ms-correlation-request-id": [ "dc2f9925-be87-437c-8f62-38625d9fda09" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141613Z:dc2f9925-be87-437c-8f62-38625d9fda09" ], + "Date": [ "Thu, 21 May 2020 14:16:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11926" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b98693a3-14ab-4452-84b4-a218a809869c" ], + "x-ms-correlation-request-id": [ "b98693a3-14ab-4452-84b4-a218a809869c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141643Z:b98693a3-14ab-4452-84b4-a218a809869c" ], + "Date": [ "Thu, 21 May 2020 14:16:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11925" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7c61036b-086e-43c2-b935-5a8399744a39" ], + "x-ms-correlation-request-id": [ "7c61036b-086e-43c2-b935-5a8399744a39" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141714Z:7c61036b-086e-43c2-b935-5a8399744a39" ], + "Date": [ "Thu, 21 May 2020 14:17:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11924" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "x-ms-correlation-request-id": [ "773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141744Z:773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "Date": [ "Thu, 21 May 2020 14:17:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11923" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "x-ms-correlation-request-id": [ "762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141814Z:762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "Date": [ "Thu, 21 May 2020 14:18:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "857" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11922" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "x-ms-correlation-request-id": [ "048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141845Z:048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "Date": [ "Thu, 21 May 2020 14:18:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11921" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "fa317527-718f-46f4-a570-7ebcf168a806" ], + "x-ms-correlation-request-id": [ "fa317527-718f-46f4-a570-7ebcf168a806" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141845Z:fa317527-718f-46f4-a570-7ebcf168a806" ], + "Date": [ "Thu, 21 May 2020 14:18:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "89" ], + "x-ms-client-request-id": [ "ba2a75aa-ecfc-4074-b7c3-e8e25966a2f5" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11920" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "x-ms-correlation-request-id": [ "6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141846Z:6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "Date": [ "Thu, 21 May 2020 14:18:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..3d68022d3b84 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,23 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainMember' { + It 'CreateExpanded' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $bcMemberName = "myblockchain" + $env.rstr2 + New-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup -Consortium ('PowershellConsortiumName' + $env.rstr2) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + $bcMember = Get-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + $bcMember.Name | Should -Be $bcMemberName + } +} diff --git a/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json new file mode 100644 index 000000000000..040710fd60b7 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json @@ -0,0 +1,187 @@ +{ + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "90" ], + "x-ms-client-request-id": [ "2bf5676f-0dc8-49cc-b7ac-de58fc166446" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "x-ms-correlation-request-id": [ "d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141847Z:d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "Date": [ "Thu, 21 May 2020 14:18:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"8y6u3WirRR8jx1I25vLPYgvY\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "x-ms-correlation-request-id": [ "74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "Date": [ "Thu, 21 May 2020 14:18:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"zJ-3AMTNbqDn_MixEAkiz1ig\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "92" ], + "x-ms-client-request-id": [ "fe4fd03c-56b7-417e-9de3-7dcfd60b33ce" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "x-ms-correlation-request-id": [ "0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "Date": [ "Thu, 21 May 2020 14:18:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"zJ-3AMTNbqDn_MixEAkiz1ig\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "93" ], + "x-ms-client-request-id": [ "bc4ae6e6-8ef0-4100-b0aa-aa0a5290c203" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11919" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "x-ms-correlation-request-id": [ "8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "Date": [ "Thu, 21 May 2020 14:18:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "x-ms-correlation-request-id": [ "58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141849Z:58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "Date": [ "Thu, 21 May 2020 14:18:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"XEZpwH_GIBvuVN6DEUOPrL43\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 new file mode 100644 index 000000000000..b44a4c7f5cd1 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainMemberApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainMemberApiKey' { + $keyPair = {} + It 'RegenerateExpanded' { + $keys = New-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + It 'RegenerateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + $bcMember = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $keys = New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + #$PSDefaultParameterValues["Disabled"] = $False + } + + BeforeEach { + $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + } +} diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..20e8c496c9a8 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,582 @@ +{ + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@1\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "97" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "x-ms-correlation-request-id": [ "756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141851Z:756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "Date": [ "Thu, 21 May 2020 14:18:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "532" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":null,\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11918" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "x-ms-correlation-request-id": [ "db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141921Z:db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "Date": [ "Thu, 21 May 2020 14:19:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11917" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "x-ms-correlation-request-id": [ "27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141951Z:27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "Date": [ "Thu, 21 May 2020 14:19:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11916" ], + "x-ms-request-id": [ "e479ff92-2050-4565-9ea1-d727aec8c148" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "e479ff92-2050-4565-9ea1-d727aec8c148" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142022Z:e479ff92-2050-4565-9ea1-d727aec8c148" ], + "Date": [ "Thu, 21 May 2020 14:20:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11915" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "x-ms-correlation-request-id": [ "00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142053Z:00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "Date": [ "Thu, 21 May 2020 14:20:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11914" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "x-ms-correlation-request-id": [ "3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142123Z:3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "Date": [ "Thu, 21 May 2020 14:21:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11913" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "x-ms-correlation-request-id": [ "6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142153Z:6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "Date": [ "Thu, 21 May 2020 14:21:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11912" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "x-ms-correlation-request-id": [ "a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142224Z:a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "Date": [ "Thu, 21 May 2020 14:22:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11911" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "x-ms-correlation-request-id": [ "9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142254Z:9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "Date": [ "Thu, 21 May 2020 14:22:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11910" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b088da3f-0f9e-4202-9ea1-33267271b820" ], + "x-ms-correlation-request-id": [ "b088da3f-0f9e-4202-9ea1-33267271b820" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142324Z:b088da3f-0f9e-4202-9ea1-33267271b820" ], + "Date": [ "Thu, 21 May 2020 14:23:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11909" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "x-ms-correlation-request-id": [ "61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142355Z:61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "Date": [ "Thu, 21 May 2020 14:23:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11908" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3e562c79-c099-4374-852c-e6e527f434ce" ], + "x-ms-correlation-request-id": [ "3e562c79-c099-4374-852c-e6e527f434ce" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142425Z:3e562c79-c099-4374-852c-e6e527f434ce" ], + "Date": [ "Thu, 21 May 2020 14:24:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11907" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "63de3fde-96f7-4cee-b672-04072f493829" ], + "x-ms-correlation-request-id": [ "63de3fde-96f7-4cee-b672-04072f493829" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142455Z:63de3fde-96f7-4cee-b672-04072f493829" ], + "Date": [ "Thu, 21 May 2020 14:24:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11906" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "x-ms-correlation-request-id": [ "d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142456Z:d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "Date": [ "Thu, 21 May 2020 14:24:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "109" ], + "x-ms-client-request-id": [ "99b2a82c-9740-4bdb-a49d-56705ce4c52b" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11905" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "x-ms-correlation-request-id": [ "6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142456Z:6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "Date": [ "Thu, 21 May 2020 14:24:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..81a40ea64320 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainTransactionNode' { + It 'CreateExpanded' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $tNodeName = "myblockchain" + $env.rstr2 + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup -Password $passwd -Location eastus + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $tNodeName + $tNode.Name | Should -Be $tNodeName + } +} diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json new file mode 100644 index 000000000000..42d3c1b5f2fd --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json @@ -0,0 +1,187 @@ +{ + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "110" ], + "x-ms-client-request-id": [ "459eb7b5-082a-4e14-871e-5bc46f157323" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "x-ms-correlation-request-id": [ "5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142457Z:5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "Date": [ "Thu, 21 May 2020 14:24:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"HvMwIKaC9H5KSiWnEieqsDad\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "x-ms-correlation-request-id": [ "7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142458Z:7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"xfSJCMZrToSSC5Qio_gah-gU\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "112" ], + "x-ms-client-request-id": [ "1270aa6a-4071-4ec8-b559-3906fdd13079" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "x-ms-correlation-request-id": [ "cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142458Z:cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"xfSJCMZrToSSC5Qio_gah-gU\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "113" ], + "x-ms-client-request-id": [ "e7ddde34-8932-4e74-be54-c455efa37dd7" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11904" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "x-ms-correlation-request-id": [ "c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142459Z:c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "x-ms-correlation-request-id": [ "50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142500Z:50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "Date": [ "Thu, 21 May 2020 14:24:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"JQZJTy2BGZFVjt_YoWQ7mhcP\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 new file mode 100644 index 000000000000..29d2cd0ddc10 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 @@ -0,0 +1,31 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainTransactionNodeApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainTransactionNodeApiKey' { + $keyPair = {} + + It 'RegenerateExpanded' { + $keys = New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + It 'RegenerateViaIdentityExpanded' { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + $keys = New-AzBlockchainTransactionNodeApiKey -InputObject $tnode -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + BeforeEach { + $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + } +} diff --git a/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json b/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..2a27b9c1217b --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json @@ -0,0 +1,2325 @@ +{ + "Remove-AzBlockchainMember+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": "{\n \"location\": \"eastus\",\n \"properties\": {\n \"consortium\": \"consortiumtxgbo1\",\n \"consortiumManagementAccountPassword\": \"strongConsortiumManagementPassword@1\",\n \"password\": \"strongMemberAccountPassword@1\",\n \"protocol\": \"Quorum\"\n },\n \"sku\": {\n \"name\": \"S0\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "x-ms-request-id": [ "0ccb65d9-bf02-451e-814a-447681d6981b" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "0ccb65d9-bf02-451e-814a-447681d6981b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142507Z:0ccb65d9-bf02-451e-814a-447681d6981b" ], + "Date": [ "Thu, 21 May 2020 14:25:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "797" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11903" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ea92c513-f20b-4644-9a89-8c220f14a296" ], + "x-ms-correlation-request-id": [ "ea92c513-f20b-4644-9a89-8c220f14a296" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142538Z:ea92c513-f20b-4644-9a89-8c220f14a296" ], + "Date": [ "Thu, 21 May 2020 14:25:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11902" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "x-ms-correlation-request-id": [ "a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142609Z:a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "Date": [ "Thu, 21 May 2020 14:26:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11901" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "x-ms-correlation-request-id": [ "6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142639Z:6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "Date": [ "Thu, 21 May 2020 14:26:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11900" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "x-ms-correlation-request-id": [ "aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142709Z:aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "Date": [ "Thu, 21 May 2020 14:27:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11899" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "x-ms-correlation-request-id": [ "cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142740Z:cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "Date": [ "Thu, 21 May 2020 14:27:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11898" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "x-ms-correlation-request-id": [ "4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142810Z:4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "Date": [ "Thu, 21 May 2020 14:28:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11897" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "x-ms-correlation-request-id": [ "1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142840Z:1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "Date": [ "Thu, 21 May 2020 14:28:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11896" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "x-ms-correlation-request-id": [ "9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142911Z:9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "Date": [ "Thu, 21 May 2020 14:29:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11895" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "x-ms-correlation-request-id": [ "650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142941Z:650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "Date": [ "Thu, 21 May 2020 14:29:41 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11894" ], + "x-ms-request-id": [ "d8e4781b-e909-4322-9333-1068c511c6d9" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "d8e4781b-e909-4322-9333-1068c511c6d9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143011Z:d8e4781b-e909-4322-9333-1068c511c6d9" ], + "Date": [ "Thu, 21 May 2020 14:30:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11893" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "78dfc241-dd6b-449f-9563-910fe6148459" ], + "x-ms-correlation-request-id": [ "78dfc241-dd6b-449f-9563-910fe6148459" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143043Z:78dfc241-dd6b-449f-9563-910fe6148459" ], + "Date": [ "Thu, 21 May 2020 14:30:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11892" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "731c5944-3b07-468d-ba77-e7be32ece74d" ], + "x-ms-correlation-request-id": [ "731c5944-3b07-468d-ba77-e7be32ece74d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143113Z:731c5944-3b07-468d-ba77-e7be32ece74d" ], + "Date": [ "Thu, 21 May 2020 14:31:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "843" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11891" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "x-ms-correlation-request-id": [ "c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143143Z:c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "Date": [ "Thu, 21 May 2020 14:31:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "961" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0xc81133f8de72ff1e9096b53b5eaf6726b1f9a17f\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchaintxgbo1.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128", "129" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11890" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "x-ms-correlation-request-id": [ "eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143144Z:eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "Date": [ "Thu, 21 May 2020 14:31:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "961" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0xc81133f8de72ff1e9096b53b5eaf6726b1f9a17f\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchaintxgbo1.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-request-id": [ "3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "x-ms-correlation-request-id": [ "3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143144Z:3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "Date": [ "Thu, 21 May 2020 14:31:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11889" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "x-ms-correlation-request-id": [ "a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143215Z:a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "Date": [ "Thu, 21 May 2020 14:32:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11888" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "x-ms-correlation-request-id": [ "de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143245Z:de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "Date": [ "Thu, 21 May 2020 14:32:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11887" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "x-ms-correlation-request-id": [ "fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143316Z:fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "Date": [ "Thu, 21 May 2020 14:33:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11886" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "x-ms-correlation-request-id": [ "1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143346Z:1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "Date": [ "Thu, 21 May 2020 14:33:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+21": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11885" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "x-ms-correlation-request-id": [ "c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143416Z:c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "Date": [ "Thu, 21 May 2020 14:34:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+22": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11884" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "x-ms-correlation-request-id": [ "9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143447Z:9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "Date": [ "Thu, 21 May 2020 14:34:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+23": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11883" ], + "x-ms-request-id": [ "5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143517Z:5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "Date": [ "Thu, 21 May 2020 14:35:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+24": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11882" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "x-ms-correlation-request-id": [ "2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143547Z:2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "Date": [ "Thu, 21 May 2020 14:35:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+25": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11881" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "26a98005-d446-4155-9210-115ae5741c5f" ], + "x-ms-correlation-request-id": [ "26a98005-d446-4155-9210-115ae5741c5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143618Z:26a98005-d446-4155-9210-115ae5741c5f" ], + "Date": [ "Thu, 21 May 2020 14:36:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+26": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11880" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "x-ms-correlation-request-id": [ "b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143648Z:b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "Date": [ "Thu, 21 May 2020 14:36:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+27": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11879" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "x-ms-correlation-request-id": [ "f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143718Z:f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "Date": [ "Thu, 21 May 2020 14:37:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+28": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11878" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "x-ms-correlation-request-id": [ "e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143749Z:e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "Date": [ "Thu, 21 May 2020 14:37:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+29": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11877" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "x-ms-correlation-request-id": [ "6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143819Z:6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "Date": [ "Thu, 21 May 2020 14:38:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+30": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11876" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "x-ms-correlation-request-id": [ "78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143850Z:78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "Date": [ "Thu, 21 May 2020 14:38:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+31": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11875" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "x-ms-correlation-request-id": [ "bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143920Z:bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "Date": [ "Thu, 21 May 2020 14:39:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+32": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11874" ], + "x-ms-request-id": [ "a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143950Z:a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "Date": [ "Thu, 21 May 2020 14:39:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+33": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11873" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "x-ms-correlation-request-id": [ "a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144021Z:a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "Date": [ "Thu, 21 May 2020 14:40:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+34": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11872" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "x-ms-correlation-request-id": [ "9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144052Z:9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "Date": [ "Thu, 21 May 2020 14:40:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+35": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11871" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "x-ms-correlation-request-id": [ "dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144125Z:dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "Date": [ "Thu, 21 May 2020 14:41:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+36": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11870" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "x-ms-correlation-request-id": [ "8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144155Z:8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "Date": [ "Thu, 21 May 2020 14:41:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+37": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11869" ], + "x-ms-request-id": [ "9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "x-ms-correlation-request-id": [ "9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144226Z:9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+38": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151", "152" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11868" ], + "x-ms-request-id": [ "3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "x-ms-correlation-request-id": [ "3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144226Z:3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+39": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "153" ], + "x-ms-client-request-id": [ "8f097578-4f12-4ddf-823f-b2354299a364" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11867" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4a452765-b385-48a8-84a4-561bb339e992" ], + "x-ms-correlation-request-id": [ "4a452765-b385-48a8-84a4-561bb339e992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144227Z:4a452765-b385-48a8-84a4-561bb339e992" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2848" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainl9b8e0\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "154" ], + "x-ms-client-request-id": [ "6b32d730-16a5-4682-a3c6-e9a0e5b4d22f" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11866" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "x-ms-correlation-request-id": [ "48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144227Z:48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "Date": [ "Thu, 21 May 2020 14:42:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":\"0x3e540354d116ba43930f178db126cbdaec727607\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-request-id": [ "80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "x-ms-correlation-request-id": [ "80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144228Z:80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "Date": [ "Thu, 21 May 2020 14:42:28 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11865" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "x-ms-correlation-request-id": [ "8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144258Z:8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "Date": [ "Thu, 21 May 2020 14:42:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11864" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "x-ms-correlation-request-id": [ "6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144329Z:6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "Date": [ "Thu, 21 May 2020 14:43:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11863" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "x-ms-correlation-request-id": [ "b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144359Z:b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "Date": [ "Thu, 21 May 2020 14:43:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11862" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "x-ms-correlation-request-id": [ "bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144429Z:bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "Date": [ "Thu, 21 May 2020 14:44:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11861" ], + "x-ms-request-id": [ "6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144500Z:6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "Date": [ "Thu, 21 May 2020 14:44:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11860" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "073718e0-15f5-4325-ac13-e080c45df24e" ], + "x-ms-correlation-request-id": [ "073718e0-15f5-4325-ac13-e080c45df24e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144531Z:073718e0-15f5-4325-ac13-e080c45df24e" ], + "Date": [ "Thu, 21 May 2020 14:45:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11859" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "x-ms-correlation-request-id": [ "15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144601Z:15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "Date": [ "Thu, 21 May 2020 14:46:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11858" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "693fb903-004c-4313-a0d0-b540137769f4" ], + "x-ms-correlation-request-id": [ "693fb903-004c-4313-a0d0-b540137769f4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144632Z:693fb903-004c-4313-a0d0-b540137769f4" ], + "Date": [ "Thu, 21 May 2020 14:46:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "x-ms-correlation-request-id": [ "cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144702Z:cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "Date": [ "Thu, 21 May 2020 14:47:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "51af4343-cb4f-40b1-90f2-086547d71a67" ], + "x-ms-correlation-request-id": [ "51af4343-cb4f-40b1-90f2-086547d71a67" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144732Z:51af4343-cb4f-40b1-90f2-086547d71a67" ], + "Date": [ "Thu, 21 May 2020 14:47:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "x-ms-correlation-request-id": [ "13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144803Z:13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "Date": [ "Thu, 21 May 2020 14:48:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "954bf57b-e297-4984-8222-a8015728b791" ], + "x-ms-correlation-request-id": [ "954bf57b-e297-4984-8222-a8015728b791" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144833Z:954bf57b-e297-4984-8222-a8015728b791" ], + "Date": [ "Thu, 21 May 2020 14:48:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7c027b93-5608-4fae-af08-391edea1add4" ], + "x-ms-correlation-request-id": [ "7c027b93-5608-4fae-af08-391edea1add4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144904Z:7c027b93-5608-4fae-af08-391edea1add4" ], + "Date": [ "Thu, 21 May 2020 14:49:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "x-ms-correlation-request-id": [ "c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144934Z:c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "Date": [ "Thu, 21 May 2020 14:49:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11858" ], + "x-ms-request-id": [ "5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145004Z:5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "Date": [ "Thu, 21 May 2020 14:50:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170", "171" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "x-ms-request-id": [ "f9d30523-054e-4354-b556-d527df6aca5f" ], + "x-ms-correlation-request-id": [ "f9d30523-054e-4354-b556-d527df6aca5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145035Z:f9d30523-054e-4354-b556-d527df6aca5f" ], + "Date": [ "Thu, 21 May 2020 14:50:35 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170", "171", "172" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "x-ms-request-id": [ "3c797104-756e-43f6-982f-fce81eea4a93" ], + "x-ms-correlation-request-id": [ "3c797104-756e-43f6-982f-fce81eea4a93" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145036Z:3c797104-756e-43f6-982f-fce81eea4a93" ], + "Date": [ "Thu, 21 May 2020 14:50:36 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "173" ], + "x-ms-client-request-id": [ "36f022be-1d17-4805-80c5-0d927793c529" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "66d8b73d-53af-4632-8aae-4d4420697b66" ], + "x-ms-correlation-request-id": [ "66d8b73d-53af-4632-8aae-4d4420697b66" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145036Z:66d8b73d-53af-4632-8aae-4d4420697b66" ], + "Date": [ "Thu, 21 May 2020 14:50:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1907" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainl9b8e0\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..e17142de3dda --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzBlockchainMember' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + It 'Delete' { + $bcMemberName = "myblockchain" + $env.rstr3 + New-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup -Consortium ("consortium" + $env.rstr3) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + Remove-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + $bcMemberList = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMemberList.Name | Should -Not -Contain $bcMemberName + } + + It 'DeleteViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $bcMemberName = "myblockchain" + $env.rstr4 + $member = Get-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + Remove-AzBlockchainMember -InputObject $member + $bcMemberList = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMemberList.Name | Should -Not -Contain $bcMemberName + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..985f39bf4b47 --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,1406 @@ +{ + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@1\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "97" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "x-ms-correlation-request-id": [ "f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145039Z:f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "Date": [ "Thu, 21 May 2020 14:50:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "535" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":null,\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "x-ms-correlation-request-id": [ "5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145109Z:5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "Date": [ "Thu, 21 May 2020 14:51:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "270664a8-abce-410b-a5b3-cb23464a2162" ], + "x-ms-correlation-request-id": [ "270664a8-abce-410b-a5b3-cb23464a2162" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145140Z:270664a8-abce-410b-a5b3-cb23464a2162" ], + "Date": [ "Thu, 21 May 2020 14:51:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "x-ms-correlation-request-id": [ "8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145210Z:8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "Date": [ "Thu, 21 May 2020 14:52:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "x-ms-correlation-request-id": [ "099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145240Z:099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "Date": [ "Thu, 21 May 2020 14:52:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "x-ms-correlation-request-id": [ "50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145311Z:50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "Date": [ "Thu, 21 May 2020 14:53:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "x-ms-correlation-request-id": [ "38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145341Z:38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "Date": [ "Thu, 21 May 2020 14:53:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "x-ms-correlation-request-id": [ "9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145411Z:9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "Date": [ "Thu, 21 May 2020 14:54:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "x-ms-correlation-request-id": [ "8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145442Z:8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "Date": [ "Thu, 21 May 2020 14:54:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "x-ms-request-id": [ "854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145512Z:854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "Date": [ "Thu, 21 May 2020 14:55:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "x-ms-correlation-request-id": [ "695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145543Z:695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "Date": [ "Thu, 21 May 2020 14:55:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "747500b1-38b0-449a-be0d-c11a00da56f4" ], + "x-ms-correlation-request-id": [ "747500b1-38b0-449a-be0d-c11a00da56f4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145613Z:747500b1-38b0-449a-be0d-c11a00da56f4" ], + "Date": [ "Thu, 21 May 2020 14:56:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "x-ms-correlation-request-id": [ "4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "Date": [ "Thu, 21 May 2020 14:56:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"/+UKrZlYMCEUTkCn8bHOZvFyP/IXsqen6yu+50VYsx0=\",\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186", "187" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "x-ms-correlation-request-id": [ "e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "Date": [ "Thu, 21 May 2020 14:56:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"/+UKrZlYMCEUTkCn8bHOZvFyP/IXsqen6yu+50VYsx0=\",\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14997" ], + "x-ms-request-id": [ "53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "x-ms-correlation-request-id": [ "53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "Date": [ "Thu, 21 May 2020 14:56:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "x-ms-correlation-request-id": [ "f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145715Z:f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "Date": [ "Thu, 21 May 2020 14:57:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "x-ms-correlation-request-id": [ "95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145745Z:95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "Date": [ "Thu, 21 May 2020 14:57:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "31fd1349-7560-49dc-ba30-620089c61fa5" ], + "x-ms-correlation-request-id": [ "31fd1349-7560-49dc-ba30-620089c61fa5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145815Z:31fd1349-7560-49dc-ba30-620089c61fa5" ], + "Date": [ "Thu, 21 May 2020 14:58:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "x-ms-correlation-request-id": [ "0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145846Z:0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "Date": [ "Thu, 21 May 2020 14:58:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "x-ms-correlation-request-id": [ "c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145916Z:c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "Date": [ "Thu, 21 May 2020 14:59:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+21": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "x-ms-correlation-request-id": [ "6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145946Z:6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "Date": [ "Thu, 21 May 2020 14:59:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+22": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "x-ms-request-id": [ "504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150017Z:504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "Date": [ "Thu, 21 May 2020 15:00:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+23": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "x-ms-correlation-request-id": [ "e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150048Z:e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "Date": [ "Thu, 21 May 2020 15:00:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+24": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "x-ms-correlation-request-id": [ "817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150118Z:817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "Date": [ "Thu, 21 May 2020 15:01:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+25": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "x-ms-correlation-request-id": [ "7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150148Z:7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "Date": [ "Thu, 21 May 2020 15:01:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+26": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "x-ms-request-id": [ "d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "x-ms-correlation-request-id": [ "d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150219Z:d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "Date": [ "Thu, 21 May 2020 15:02:18 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+27": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199", "200" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "x-ms-request-id": [ "5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "x-ms-correlation-request-id": [ "5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150219Z:5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "Date": [ "Thu, 21 May 2020 15:02:18 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+28": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "201" ], + "x-ms-client-request-id": [ "6b3447df-4ef5-4ee9-a4a2-aaf76f3efee6" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "x-ms-correlation-request-id": [ "c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "Date": [ "Thu, 21 May 2020 15:02:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1915" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}]}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "202" ], + "x-ms-client-request-id": [ "02675717-aa94-4751-9d74-deda426fddbf" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "x-ms-correlation-request-id": [ "2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "Date": [ "Thu, 21 May 2020 15:02:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14996" ], + "x-ms-request-id": [ "3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "x-ms-correlation-request-id": [ "3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "Date": [ "Thu, 21 May 2020 15:02:20 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7f6a3381-6213-4cc7-8531-018170b3e592" ], + "x-ms-correlation-request-id": [ "7f6a3381-6213-4cc7-8531-018170b3e592" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150251Z:7f6a3381-6213-4cc7-8531-018170b3e592" ], + "Date": [ "Thu, 21 May 2020 15:02:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "x-ms-correlation-request-id": [ "4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150321Z:4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "Date": [ "Thu, 21 May 2020 15:03:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11846" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "35d286b0-cd43-4445-a707-c0a207380552" ], + "x-ms-correlation-request-id": [ "35d286b0-cd43-4445-a707-c0a207380552" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150352Z:35d286b0-cd43-4445-a707-c0a207380552" ], + "Date": [ "Thu, 21 May 2020 15:03:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206", "207" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11845" ], + "x-ms-request-id": [ "e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "x-ms-correlation-request-id": [ "e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150422Z:e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "Date": [ "Thu, 21 May 2020 15:04:21 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206", "207", "208" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11844" ], + "x-ms-request-id": [ "f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "x-ms-correlation-request-id": [ "f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150423Z:f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "Date": [ "Thu, 21 May 2020 15:04:22 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "209" ], + "x-ms-client-request-id": [ "bdfeadf6-a86c-4eaa-ad19-0052e0bf5625" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11843" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "x-ms-correlation-request-id": [ "a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150423Z:a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "Date": [ "Thu, 21 May 2020 15:04:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1279" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..c006b5a5bd24 --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,33 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzBlockchainTransactionNode' { + It 'Delete' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $tNodeName = "tranctionnode" + $env.rstr3 + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd + Remove-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup + $tNodeList = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodeList.Name | Should -Not -Contain $tNodeName + } + + It 'DeleteViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $tNodeName = "tranctionnode" + $env.rstr4 + $node = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup + Remove-AzBlockchainTransactionNode -InputObject $node + $tNodeList = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodeList.Name | Should -Not -Contain $tNodeName + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json new file mode 100644 index 000000000000..edd6f27a7256 --- /dev/null +++ b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json @@ -0,0 +1,70 @@ +{ + "Test-AzBlockchainLocationNameAvailability+[NoContext]+CheckExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview", + "Content": "{\n \"name\": \"123\",\n \"type\": \"Microsoft.Blockchain/blockchainMembers\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "71" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11842" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "x-ms-correlation-request-id": [ "3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150424Z:3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "Date": [ "Thu, 21 May 2020 15:04:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "234" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nameAvailable\":false,\"message\":\"The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long.\",\"reason\":\"Invalid\"}" + } + }, + "Test-AzBlockchainLocationNameAvailability+[NoContext]+CheckExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview", + "Content": "{\n \"name\": \"lucasblockchain01\",\n \"type\": \"Microsoft.Blockchain/blockchainMembers\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "85" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11841" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "x-ms-correlation-request-id": [ "b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150425Z:b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "Date": [ "Thu, 21 May 2020 15:04:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "61" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nameAvailable\":true,\"message\":null,\"reason\":\"NotSpecified\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 new file mode 100644 index 000000000000..31b9751362b0 --- /dev/null +++ b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzBlockchainLocationNameAvailability.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Test-AzBlockchainLocationNameAvailability' { + It 'CheckExpanded' { + $result = Test-AzBlockchainLocationNameAvailability -Location eastus -Name '123' -Type Microsoft.Blockchain/blockchainMembers + $result.NameAvailable| Should -Be $False + + $result = Test-AzBlockchainLocationNameAvailability -Location eastus -Name 'lucasblockchain01' -Type Microsoft.Blockchain/blockchainMembers + $result.NameAvailable| Should -Be $True + } +} diff --git a/src/Blockchain/test/Update-AzBlockchainMember.Recording.json b/src/Blockchain/test/Update-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..4b9d8d5a48c6 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainMember.Recording.json @@ -0,0 +1,255 @@ +{ + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@2\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "19b78263-c409-40be-90d9-2e536d7b07f5" ], + "x-ms-correlation-request-id": [ "19b78263-c409-40be-90d9-2e536d7b07f5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150426Z:19b78263-c409-40be-90d9-2e536d7b07f5" ], + "Date": [ "Thu, 21 May 2020 15:04:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "773" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"tags\": {\n \"update\": \"password\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "44" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "x-ms-correlation-request-id": [ "75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "790" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "214" ], + "x-ms-client-request-id": [ "2d7d13da-88b4-4d77-b857-0e68a85ae118" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11840" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "x-ms-correlation-request-id": [ "17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "997" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "215" ], + "x-ms-client-request-id": [ "608e5d36-b6b4-42ea-9973-83499f6102b6" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11839" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "x-ms-correlation-request-id": [ "9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "997" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@3\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "316f8a62-4910-4770-988d-6a83759141cc" ], + "x-ms-correlation-request-id": [ "316f8a62-4910-4770-988d-6a83759141cc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150432Z:316f8a62-4910-4770-988d-6a83759141cc" ], + "Date": [ "Thu, 21 May 2020 15:04:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "773" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"tags\": {\n \"againupdate\": \"password\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "49" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "x-ms-correlation-request-id": [ "3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150436Z:3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "Date": [ "Thu, 21 May 2020 15:04:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "795" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"againupdate\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "218" ], + "x-ms-client-request-id": [ "ab6c51ba-e3eb-4228-91bc-f23e20f6f02a" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11838" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "x-ms-correlation-request-id": [ "d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150436Z:d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "Date": [ "Thu, 21 May 2020 15:04:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1002" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"againupdate\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..76a3a1e56b83 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzBlockchainMember' { + $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force + $passwd3 = 'strongMemberAccountPassword@3' | ConvertTo-SecureString -AsPlainText -Force + It 'UpdateExpanded' { + $tag = @{'update'='password'} + Update-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Password $passwd2 + Update-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Tag $tag + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $member.Tag.ContainsKey('update') | Should -Be $True + } + + It 'UpdateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + $tag = @{'againupdate'='password'} + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + Update-AzBlockchainMember -InputObject $member -Password $passwd3 + Update-AzBlockchainMember -InputObject $member -Tag $tag + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $member.Tag.ContainsKey('againupdate') | Should -Be $True + } +} diff --git a/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..816b6ce39ef4 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,109 @@ +{ + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@2\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "289159d5-3e3a-4726-8377-5ca917d924fa" ], + "x-ms-correlation-request-id": [ "289159d5-3e3a-4726-8377-5ca917d924fa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150437Z:289159d5-3e3a-4726-8377-5ca917d924fa" ], + "Date": [ "Thu, 21 May 2020 15:04:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "554" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":null},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "220" ], + "x-ms-client-request-id": [ "4cf2c0fe-9735-43c4-aeaf-9a70f6eb580b" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11837" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "x-ms-correlation-request-id": [ "f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150438Z:f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "Date": [ "Thu, 21 May 2020 15:04:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@3\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "x-ms-correlation-request-id": [ "ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150439Z:ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "Date": [ "Thu, 21 May 2020 15:04:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "554" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":null},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..624168718fa9 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzBlockchainTransactionNode' { + $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force + $passwd3 = 'strongMemberAccountPassword@3' | ConvertTo-SecureString -AsPlainText -Force + It 'UpdateExpanded' { + { Update-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $env.blockchainTransactionNode -ResourceGroupName $env.resourceGroup -Password $passwd2 } | Should -Not -Throw + + } + + It 'UpdateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + Update-AzBlockchainTransactionNode -InputObject $tNode -Password $passwd3 + } | Should -Not -Throw + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/env.json b/src/Blockchain/test/env.json new file mode 100644 index 000000000000..51c810cb0698 --- /dev/null +++ b/src/Blockchain/test/env.json @@ -0,0 +1,17 @@ +{ + "resourceGroup": "testgrouphv0x8n", + "passwd": { + "Length": 29 + }, + "blockchainMember": "myblockchainhv0x8n", + "rstr1": "hv0x8n", + "blockchainTransactionNode": "tranctionnodehv0x8n", + "csPasswd": { + "Length": 36 + }, + "rstr4": "lcnk5s", + "rstr3": "txgbo1", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "rstr2": "l9b8e0" +} diff --git a/src/Blockchain/test/loadEnv.ps1 b/src/Blockchain/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/Blockchain/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Blockchain/test/readme.md b/src/Blockchain/test/readme.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/Blockchain/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/Blockchain/test/utils.ps1 b/src/Blockchain/test/utils.ps1 new file mode 100644 index 000000000000..b4e171809fec --- /dev/null +++ b/src/Blockchain/test/utils.ps1 @@ -0,0 +1,57 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} + +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + # Generate some random strings for use in the test. + $rstr1 = RandomString -allChars $false -len 6 + $rstr2 = RandomString -allChars $false -len 6 + $rstr3 = RandomString -allChars $false -len 6 + $rstr4 = RandomString -allChars $false -len 6 + $env.Add("rstr1", $rstr1) + $env.Add("rstr2", $rstr2) + $env.Add("rstr3", $rstr3) + $env.Add("rstr4", $rstr4) + + # Create the test group + write-host "start to create test group" + $resourceGroup = "testgroup" + $env.rstr1 + $env.Add("resourceGroup", $resourceGroup) + New-AzResourceGroup -Name $resourceGroup -Location eastus + + # Create the test blockchain member + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $env.Add("passwd", $passwd) + $env.Add("csPasswd", $csPasswd) + $env.Add("blockchainMember", "myblockchain" + $rstr1) + New-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Consortium ('consortium' + $env.rstr1) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + New-AzBlockchainMember -Name ("myblockchain" + $rstr4) -ResourceGroupName $env.resourceGroup -Consortium ('consortium' + $env.rstr4) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + + # Create the test blockchain transaction node + $env.Add("blockchainTransactionNode", "tranctionnode" + $rstr1) + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $env.blockchainTransactionNode -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd -confirm:$false + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name ("tranctionnode" + $rstr4) -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd -confirm:$false + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing + # Removing resourcegroup will clean all the resources created for testing. + Remove-AzResourceGroup -Name $env.resourceGroup +} + From 02095af755d49f09da1b98372e7b8227b74de84d Mon Sep 17 00:00:00 2001 From: Dingmeng Xue Date: Mon, 25 May 2020 14:52:58 +0800 Subject: [PATCH 3/5] update release files --- documentation/azure-powershell-modules.md | 9 ++++ src/Blockchain/Az.BlockChain.psd1 | 3 +- src/Blockchain/Az.Blockchain.csproj | 7 +++ src/Blockchain/Blockchain.sln | 48 +++++++++++++++++++++ src/Blockchain/ChangeLog.md | 24 +++++++++++ src/Blockchain/Properties/AssemblyInfo.cs | 28 ++++++++++++ src/ImageBuilder/Az.ImageBuilder.csproj | 7 +++ src/ImageBuilder/Az.ImageBuilder.psd1 | 3 +- src/ImageBuilder/ChangeLog.md | 24 +++++++++++ src/ImageBuilder/ImageBuilder.sln | 48 +++++++++++++++++++++ src/ImageBuilder/Properties/AssemblyInfo.cs | 28 ++++++++++++ src/ImportExport/Az.ImportExport.csproj | 7 +++ src/ImportExport/Az.ImportExport.psd1 | 3 +- src/ImportExport/ChangeLog.md | 24 +++++++++++ src/ImportExport/ImportExport.sln | 48 +++++++++++++++++++++ src/ImportExport/Properties/AssemblyInfo.cs | 28 ++++++++++++ tools/CreateMappings_rules.json | 3 ++ tools/GenerateHelp.ps1 | 3 ++ 18 files changed, 342 insertions(+), 3 deletions(-) create mode 100644 src/Blockchain/Az.Blockchain.csproj create mode 100644 src/Blockchain/Blockchain.sln create mode 100644 src/Blockchain/ChangeLog.md create mode 100644 src/Blockchain/Properties/AssemblyInfo.cs create mode 100644 src/ImageBuilder/Az.ImageBuilder.csproj create mode 100644 src/ImageBuilder/ChangeLog.md create mode 100644 src/ImageBuilder/ImageBuilder.sln create mode 100644 src/ImageBuilder/Properties/AssemblyInfo.cs create mode 100644 src/ImportExport/Az.ImportExport.csproj create mode 100644 src/ImportExport/ChangeLog.md create mode 100644 src/ImportExport/ImportExport.sln create mode 100644 src/ImportExport/Properties/AssemblyInfo.cs diff --git a/documentation/azure-powershell-modules.md b/documentation/azure-powershell-modules.md index 61250b5c8336..f3862e9e125f 100644 --- a/documentation/azure-powershell-modules.md +++ b/documentation/azure-powershell-modules.md @@ -22,6 +22,7 @@ Attestation | `Az.Attestation` Automation | `Az.Automation` | [![Automation]][AutomationGallery] Batch | `Az.Batch` | [![Batch]][BatchGallery] Billing | `Az.Billing` | [![Billing]][BillingGallery] +Blockchain | `Az.Blockchain` | [![Blockchain]][BlockchainGallery] Blueprints | `Az.Blueprint` | [![Blueprint]][BlueprintGallery] Content Delivery Network | `Az.Cdn` | [![Cdn]][CdnGallery] Cognitive Services | `Az.CognitiveServices` | [![CognitiveServices]][CognitiveServicesGallery] @@ -50,6 +51,8 @@ Guest Configuration | `Az.GuestConfiguration` HDInsight | `Az.HDInsight` | [![HDInsight]][HDInsightGallery] API for FHIR | `Az.HealthcareApis` | [![HealthcareApis]][HealthcareApisGallery] HPC Cache | `Az.HPCCache` | [![HPCCache]][HPCCacheGallery] +Image Builder | `Az.ImageBuilder` | [![ImageBuilder]][ImageBuilderGallery] +Import/Export | `Az.ImportExport` | [![ImportExport]][ImportExportGallery] IoT Central | `Az.IotCentral` | [![IotCentral]][IotCentralGallery] IoT Hub | `Az.IotHub` | [![IotHub]][IotHubGallery] Key Vault | `Az.KeyVault` | [![KeyVault]][KeyVaultGallery] @@ -117,6 +120,7 @@ Web App Service | `Az.Websites` [Automation]: https://img.shields.io/powershellgallery/v/Az.Automation.svg?style=flat-square&label=Az.Automation [Batch]: https://img.shields.io/powershellgallery/v/Az.Batch.svg?style=flat-square&label=Az.Batch [Billing]: https://img.shields.io/powershellgallery/v/Az.Billing.svg?style=flat-square&label=Az.Billing +[Blockchain]: https://img.shields.io/powershellgallery/v/Az.Blockchain.svg?style=flat-square&label=Az.Blockchain [Blueprint]: https://img.shields.io/powershellgallery/v/Az.Blueprint.svg?style=flat-square&label=Az.Blueprint [Cdn]: https://img.shields.io/powershellgallery/v/Az.Cdn.svg?style=flat-square&label=Az.Cdn [CognitiveServices]: https://img.shields.io/powershellgallery/v/Az.CognitiveServices.svg?style=flat-square&label=Az.CognitiveServices @@ -145,6 +149,8 @@ Web App Service | `Az.Websites` [HDInsight]: https://img.shields.io/powershellgallery/v/Az.HDInsight.svg?style=flat-square&label=Az.HDInsight [HealthcareApis]: https://img.shields.io/powershellgallery/v/Az.HealthcareApis.svg?style=flat-square&label=Az.HealthcareApis [HPCCache]: https://img.shields.io/powershellgallery/v/Az.HPCCache.svg?style=flat-square&label=Az.HPCCache +[ImportExport]: https://img.shields.io/powershellgallery/v/Az.ImportExport.svg?style=flat-square&label=Az.ImportExport +[ImageBuilder]: https://img.shields.io/powershellgallery/v/Az.ImageBuilder.svg?style=flat-square&label=Az.ImageBuilder [IotCentral]: https://img.shields.io/powershellgallery/v/Az.IotCentral.svg?style=flat-square&label=Az.IotCentral [IotHub]: https://img.shields.io/powershellgallery/v/Az.IotHub.svg?style=flat-square&label=Az.IotHub [KeyVault]: https://img.shields.io/powershellgallery/v/Az.KeyVault.svg?style=flat-square&label=Az.KeyVault @@ -210,6 +216,7 @@ Web App Service | `Az.Websites` [AutomationGallery]: https://www.powershellgallery.com/packages/Az.Automation/ [BatchGallery]: https://www.powershellgallery.com/packages/Az.Batch/ [BillingGallery]: https://www.powershellgallery.com/packages/Az.Billing/ +[BlockchainGallery]: https://www.powershellgallery.com/packages/Az.Blockchain/ [BlueprintGallery]: https://www.powershellgallery.com/packages/Az.Blueprint/ [CdnGallery]: https://www.powershellgallery.com/packages/Az.Cdn/ [CognitiveServicesGallery]: https://www.powershellgallery.com/packages/Az.CognitiveServices/ @@ -238,6 +245,8 @@ Web App Service | `Az.Websites` [HDInsightGallery]: https://www.powershellgallery.com/packages/Az.HDInsight/ [HealthcareApisGallery]: https://www.powershellgallery.com/packages/Az.HealthcareApis/ [HPCCacheGallery]: https://www.powershellgallery.com/packages/Az.HPCCache/ +[ImportExportGallery]: https://www.powershellgallery.com/packages/Az.ImportExport/ +[ImageBuilderGallery]: https://www.powershellgallery.com/packages/Az.ImageBuilder/ [IotCentralGallery]: https://www.powershellgallery.com/packages/Az.IotCentral/ [IotHubGallery]: https://www.powershellgallery.com/packages/Az.IotHub/ [KeyVaultGallery]: https://www.powershellgallery.com/packages/Az.KeyVault/ diff --git a/src/Blockchain/Az.BlockChain.psd1 b/src/Blockchain/Az.BlockChain.psd1 index 7813ba0ae211..84ffe12e42db 100644 --- a/src/Blockchain/Az.BlockChain.psd1 +++ b/src/Blockchain/Az.BlockChain.psd1 @@ -10,8 +10,9 @@ PowerShellVersion = '5.1' DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.Blockchain.private.dll' + RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.8.0'; }) FormatsToProcess = './Az.Blockchain.format.ps1xml' - FunctionsToExport = 'Get-AzBlockchainConsortium', 'Get-AzBlockchainMember', 'Get-AzBlockchainMemberApiKey', 'Get-AzBlockchainMemberConsortiumMember', 'Get-AzBlockchainSku', 'Get-AzBlockchainTransactionNode', 'Get-AzBlockchainTransactionNodeApiKey', 'New-AzBlockchainMember', 'New-AzBlockchainMemberApiKey', 'New-AzBlockchainTransactionNode', 'New-AzBlockchainTransactionNodeApiKey', 'Remove-AzBlockchainMember', 'Remove-AzBlockchainTransactionNode', 'Test-AzBlockchainLocationNameAvailability', 'Update-AzBlockchainMember', 'Update-AzBlockchainTransactionNode', '*' + FunctionsToExport = 'Get-AzBlockchainConsortium', 'Get-AzBlockchainMember', 'Get-AzBlockchainMemberApiKey', 'Get-AzBlockchainMemberConsortiumMember', 'Get-AzBlockchainSku', 'Get-AzBlockchainTransactionNode', 'Get-AzBlockchainTransactionNodeApiKey', 'New-AzBlockchainMember', 'New-AzBlockchainMemberApiKey', 'New-AzBlockchainTransactionNode', 'New-AzBlockchainTransactionNodeApiKey', 'Remove-AzBlockchainMember', 'Remove-AzBlockchainTransactionNode', 'Test-AzBlockchainLocationNameAvailability', 'Update-AzBlockchainMember', 'Update-AzBlockchainTransactionNode' AliasesToExport = '*' PrivateData = @{ PSData = @{ diff --git a/src/Blockchain/Az.Blockchain.csproj b/src/Blockchain/Az.Blockchain.csproj new file mode 100644 index 000000000000..4c029b762e85 --- /dev/null +++ b/src/Blockchain/Az.Blockchain.csproj @@ -0,0 +1,7 @@ + + + Blockchain + + + + \ No newline at end of file diff --git a/src/Blockchain/Blockchain.sln b/src/Blockchain/Blockchain.sln new file mode 100644 index 000000000000..68947b602418 --- /dev/null +++ b/src/Blockchain/Blockchain.sln @@ -0,0 +1,48 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{62843FE6-7575-4D88-B989-7DF7EEC0BC01}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{442C609B-A431-4A71-B289-08F0B63C83E5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{59E8F6B8-8F0E-403F-B88B-9736DBC396D9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.Blockchain", "Az.Blockchain.csproj", "{F3C879B0-DB94-4556-AB61-B4F727FF945E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.Build.0 = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.Build.0 = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.Build.0 = Release|Any CPU + {F3C879B0-DB94-4556-AB61-B4F727FF945E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F3C879B0-DB94-4556-AB61-B4F727FF945E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F3C879B0-DB94-4556-AB61-B4F727FF945E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F3C879B0-DB94-4556-AB61-B4F727FF945E}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F9B3D96E-9680-40BE-A917-02EE655D6030} + EndGlobalSection +EndGlobal diff --git a/src/Blockchain/ChangeLog.md b/src/Blockchain/ChangeLog.md new file mode 100644 index 000000000000..b76ecb79cf4a --- /dev/null +++ b/src/Blockchain/ChangeLog.md @@ -0,0 +1,24 @@ + +## Upcoming Release + +## Version 0.1.0 +* the first preview release + diff --git a/src/Blockchain/Properties/AssemblyInfo.cs b/src/Blockchain/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..b6940da53324 --- /dev/null +++ b/src/Blockchain/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Blockchain")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("6C3BDCDB-6201-4FC7-83FD-8F552E8AF6CA")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] \ No newline at end of file diff --git a/src/ImageBuilder/Az.ImageBuilder.csproj b/src/ImageBuilder/Az.ImageBuilder.csproj new file mode 100644 index 000000000000..3d00aec80be9 --- /dev/null +++ b/src/ImageBuilder/Az.ImageBuilder.csproj @@ -0,0 +1,7 @@ + + + ImageBuilder + + + + \ No newline at end of file diff --git a/src/ImageBuilder/Az.ImageBuilder.psd1 b/src/ImageBuilder/Az.ImageBuilder.psd1 index 59f60acbe6ac..0eb6cb1e5ff1 100644 --- a/src/ImageBuilder/Az.ImageBuilder.psd1 +++ b/src/ImageBuilder/Az.ImageBuilder.psd1 @@ -10,8 +10,9 @@ PowerShellVersion = '5.1' DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.ImageBuilder.private.dll' + RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.8.0'; }) FormatsToProcess = './Az.ImageBuilder.format.ps1xml' - FunctionsToExport = 'Get-AzImageBuilderRunOutput', 'Get-AzImageBuilderTemplate', 'New-AzImageBuilderCustomizerObject', 'New-AzImageBuilderDistributorObject', 'New-AzImageBuilderSourceObject', 'New-AzImageBuilderTemplate', 'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate', 'Stop-AzImageBuilderTemplate', '*' + FunctionsToExport = 'Get-AzImageBuilderRunOutput', 'Get-AzImageBuilderTemplate', 'New-AzImageBuilderCustomizerObject', 'New-AzImageBuilderDistributorObject', 'New-AzImageBuilderSourceObject', 'New-AzImageBuilderTemplate', 'Remove-AzImageBuilderTemplate', 'Start-AzImageBuilderTemplate', 'Stop-AzImageBuilderTemplate' AliasesToExport = '*' PrivateData = @{ PSData = @{ diff --git a/src/ImageBuilder/ChangeLog.md b/src/ImageBuilder/ChangeLog.md new file mode 100644 index 000000000000..b76ecb79cf4a --- /dev/null +++ b/src/ImageBuilder/ChangeLog.md @@ -0,0 +1,24 @@ + +## Upcoming Release + +## Version 0.1.0 +* the first preview release + diff --git a/src/ImageBuilder/ImageBuilder.sln b/src/ImageBuilder/ImageBuilder.sln new file mode 100644 index 000000000000..ba005777f30d --- /dev/null +++ b/src/ImageBuilder/ImageBuilder.sln @@ -0,0 +1,48 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{62843FE6-7575-4D88-B989-7DF7EEC0BC01}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{442C609B-A431-4A71-B289-08F0B63C83E5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{59E8F6B8-8F0E-403F-B88B-9736DBC396D9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ImageBuilder", "Az.ImageBuilder.csproj", "{1C203C0C-E0FD-40D2-B79E-C6DA52E4E350}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.Build.0 = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.Build.0 = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.Build.0 = Release|Any CPU + {1C203C0C-E0FD-40D2-B79E-C6DA52E4E350}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1C203C0C-E0FD-40D2-B79E-C6DA52E4E350}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1C203C0C-E0FD-40D2-B79E-C6DA52E4E350}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1C203C0C-E0FD-40D2-B79E-C6DA52E4E350}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F9B3D96E-9680-40BE-A917-02EE655D6030} + EndGlobalSection +EndGlobal diff --git a/src/ImageBuilder/Properties/AssemblyInfo.cs b/src/ImageBuilder/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..7d67f4bd48f8 --- /dev/null +++ b/src/ImageBuilder/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - ImageBuilder")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("032C639A-AFE3-4DEE-8B70-6B920335732D")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] \ No newline at end of file diff --git a/src/ImportExport/Az.ImportExport.csproj b/src/ImportExport/Az.ImportExport.csproj new file mode 100644 index 000000000000..f5bf9116e65f --- /dev/null +++ b/src/ImportExport/Az.ImportExport.csproj @@ -0,0 +1,7 @@ + + + ImportExport + + + + \ No newline at end of file diff --git a/src/ImportExport/Az.ImportExport.psd1 b/src/ImportExport/Az.ImportExport.psd1 index cfd94bd604ad..061d8946994a 100644 --- a/src/ImportExport/Az.ImportExport.psd1 +++ b/src/ImportExport/Az.ImportExport.psd1 @@ -10,8 +10,9 @@ PowerShellVersion = '5.1' DotNetFrameworkVersion = '4.7.2' RequiredAssemblies = './bin/Az.ImportExport.private.dll' + RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.8.0'; }) FormatsToProcess = './Az.ImportExport.format.ps1xml' - FunctionsToExport = 'Get-AzImportExport', 'Get-AzImportExportBitLockerKey', 'Get-AzImportExportLocation', 'New-AzImportExport', 'New-AzImportExportDriveListObject', 'Remove-AzImportExport', 'Update-AzImportExport', '*' + FunctionsToExport = 'Get-AzImportExport', 'Get-AzImportExportBitLockerKey', 'Get-AzImportExportLocation', 'New-AzImportExport', 'New-AzImportExportDriveListObject', 'Remove-AzImportExport', 'Update-AzImportExport' AliasesToExport = '*' PrivateData = @{ PSData = @{ diff --git a/src/ImportExport/ChangeLog.md b/src/ImportExport/ChangeLog.md new file mode 100644 index 000000000000..b76ecb79cf4a --- /dev/null +++ b/src/ImportExport/ChangeLog.md @@ -0,0 +1,24 @@ + +## Upcoming Release + +## Version 0.1.0 +* the first preview release + diff --git a/src/ImportExport/ImportExport.sln b/src/ImportExport/ImportExport.sln new file mode 100644 index 000000000000..103e4587ebc7 --- /dev/null +++ b/src/ImportExport/ImportExport.sln @@ -0,0 +1,48 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{142D7B0B-388A-4CEB-A228-7F6D423C5C2E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{62843FE6-7575-4D88-B989-7DF7EEC0BC01}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{442C609B-A431-4A71-B289-08F0B63C83E5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{59E8F6B8-8F0E-403F-B88B-9736DBC396D9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Az.ImportExport", "Az.ImportExport.csproj", "{1ED01622-E091-4940-AEFC-2F2AD191BF50}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {142D7B0B-388A-4CEB-A228-7F6D423C5C2E}.Release|Any CPU.Build.0 = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62843FE6-7575-4D88-B989-7DF7EEC0BC01}.Release|Any CPU.Build.0 = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {442C609B-A431-4A71-B289-08F0B63C83E5}.Release|Any CPU.Build.0 = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {59E8F6B8-8F0E-403F-B88B-9736DBC396D9}.Release|Any CPU.Build.0 = Release|Any CPU + {1ED01622-E091-4940-AEFC-2F2AD191BF50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1ED01622-E091-4940-AEFC-2F2AD191BF50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1ED01622-E091-4940-AEFC-2F2AD191BF50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1ED01622-E091-4940-AEFC-2F2AD191BF50}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F9B3D96E-9680-40BE-A917-02EE655D6030} + EndGlobalSection +EndGlobal diff --git a/src/ImportExport/Properties/AssemblyInfo.cs b/src/ImportExport/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..1a4792f57510 --- /dev/null +++ b/src/ImportExport/Properties/AssemblyInfo.cs @@ -0,0 +1,28 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - ImportExport")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] +[assembly: Guid("3D77CAB0-86A9-4CE3-BA86-76BCD5AB7FB1")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] \ No newline at end of file diff --git a/tools/CreateMappings_rules.json b/tools/CreateMappings_rules.json index f5094a457f11..75736acc3fac 100644 --- a/tools/CreateMappings_rules.json +++ b/tools/CreateMappings_rules.json @@ -171,6 +171,9 @@ { "regex": "Portal", "alias": "Portal" }, { "regex": "PostgreSql", "alias": "Database for PostgreSQL" }, { "regex": "Sql", "alias": "SQL" }, + { "regex": "Blockchain", "alias": "Blockchain Service" }, + { "regex": "ImportExport", "alias": "Import/Export" }, + { "regex": "ImageBuilder", "alias": "Image Builder" }, { "regex": "Functions", "alias": "Functions" }, { "regex": "DesktopVirtualization", "alias": "DesktopVirtualization" }, { "regex": "AppConfiguration", "alias": "App Configuration" }, diff --git a/tools/GenerateHelp.ps1 b/tools/GenerateHelp.ps1 index f846f790f88e..55078cbdb279 100644 --- a/tools/GenerateHelp.ps1 +++ b/tools/GenerateHelp.ps1 @@ -80,9 +80,12 @@ if ($ValidateMarkdownHelp) # We need to define new version of module instead of hardcode here $NewModules = @("Az.AppConfiguration", + "Az.Blockchain", "Az.Databricks", "Az.DesktopVirtualization", "Az.Functions", + "Az.ImageBuilder", + "Az.ImportExport", "Az.Kusto", "Az.MariaDb", "Az.MySql", From 0922f1e110b170b1f4acac552a7de2f95af349f6 Mon Sep 17 00:00:00 2001 From: msJinLei Date: Mon, 25 May 2020 15:04:57 +0800 Subject: [PATCH 4/5] Inital version of Blockchain --- src/Blockchain/Az.BlockChain.format.ps1xml | 933 ++++ src/Blockchain/Az.BlockChain.psd1 | 24 + src/Blockchain/Az.BlockChain.psm1 | 109 + src/Blockchain/MSSharedLibKey.snk | Bin 0 -> 160 bytes src/Blockchain/build-module.ps1 | 153 + src/Blockchain/check-dependencies.ps1 | 62 + .../custom/Az.Blockchain.custom.psm1 | 17 + .../custom/New-AzBlockchainMember.ps1 | 205 + .../New-AzBlockchainTransactionNode.ps1 | 148 + .../custom/Update-AzBlockchainMember.ps1 | 158 + .../Update-AzBlockchainTransactionNode.ps1 | 145 + src/Blockchain/custom/readme.md | 41 + .../examples/Get-AzBlockchainConsortium.md | 8 + .../examples/Get-AzBlockchainMember.md | 50 + .../examples/Get-AzBlockchainMemberApiKey.md | 12 + .../Get-AzBlockchainMemberConsortiumMember.md | 11 + .../examples/Get-AzBlockchainSku.md | 7 + .../Get-AzBlockchainTransactionNode.md | 34 + .../Get-AzBlockchainTransactionNodeApiKey.md | 11 + .../examples/New-AzBlockchainMember.md | 13 + .../examples/New-AzBlockchainMemberApiKey.md | 27 + .../New-AzBlockchainTransactionNode.md | 12 + .../New-AzBlockchainTransactionNodeApiKey.md | 28 + .../examples/Remove-AzBlockchainMember.md | 17 + .../Remove-AzBlockchainTransactionNode.md | 16 + ...st-AzBlockchainLocationNameAvailability.md | 22 + .../examples/Update-AzBlockchainMember.md | 25 + .../Update-AzBlockchainTransactionNode.md | 25 + src/Blockchain/export-surface.ps1 | 40 + .../exports/Get-AzBlockchainConsortium.ps1 | 133 + .../exports/Get-AzBlockchainMember.ps1 | 195 + .../exports/Get-AzBlockchainMemberApiKey.ps1 | 144 + ...Get-AzBlockchainMemberConsortiumMember.ps1 | 143 + .../exports/Get-AzBlockchainSku.ps1 | 127 + .../Get-AzBlockchainTransactionNode.ps1 | 190 + .../Get-AzBlockchainTransactionNodeApiKey.ps1 | 150 + .../exports/New-AzBlockchainMember.ps1 | 242 ++ .../exports/New-AzBlockchainMemberApiKey.ps1 | 189 + .../New-AzBlockchainTransactionNode.ps1 | 191 + .../New-AzBlockchainTransactionNodeApiKey.ps1 | 195 + .../exports/ProxyCmdletDefinitions.ps1 | 2837 ++++++++++++ .../exports/Remove-AzBlockchainMember.ps1 | 186 + .../Remove-AzBlockchainTransactionNode.ps1 | 191 + ...t-AzBlockchainLocationNameAvailability.ps1 | 154 + .../exports/Update-AzBlockchainMember.ps1 | 207 + .../Update-AzBlockchainTransactionNode.ps1 | 200 + src/Blockchain/exports/readme.md | 20 + src/Blockchain/generate-help.ps1 | 73 + src/Blockchain/generate-info.json | 8 + src/Blockchain/generated/Module.cs | 158 + src/Blockchain/generated/api/Blockchain.cs | 3810 +++++++++++++++++ .../Api20180601Preview/ApiKey.PowerShell.cs | 135 + .../ApiKey.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/ApiKey.cs | 65 + .../Models/Api20180601Preview/ApiKey.json.cs | 105 + .../ApiKeyCollection.PowerShell.cs | 133 + .../ApiKeyCollection.TypeConverter.cs | 142 + .../Api20180601Preview/ApiKeyCollection.cs | 48 + .../ApiKeyCollection.json.cs | 111 + .../BlockchainMember.PowerShell.cs | 179 + .../BlockchainMember.TypeConverter.cs | 142 + .../Api20180601Preview/BlockchainMember.cs | 352 ++ .../BlockchainMember.json.cs | 107 + .../BlockchainMemberCollection.PowerShell.cs | 137 + ...lockchainMemberCollection.TypeConverter.cs | 142 + .../BlockchainMemberCollection.cs | 75 + .../BlockchainMemberCollection.json.cs | 113 + .../BlockchainMemberNodesSku.PowerShell.cs | 133 + .../BlockchainMemberNodesSku.TypeConverter.cs | 142 + .../BlockchainMemberNodesSku.cs | 46 + .../BlockchainMemberNodesSku.json.cs | 101 + .../BlockchainMemberProperties.PowerShell.cs | 161 + ...lockchainMemberProperties.TypeConverter.cs | 142 + .../BlockchainMemberProperties.cs | 294 ++ .../BlockchainMemberProperties.json.cs | 153 + ...kchainMemberPropertiesUpdate.PowerShell.cs | 137 + ...ainMemberPropertiesUpdate.TypeConverter.cs | 142 + .../BlockchainMemberPropertiesUpdate.cs | 73 + .../BlockchainMemberPropertiesUpdate.json.cs | 103 + .../BlockchainMemberUpdate.PowerShell.cs | 143 + .../BlockchainMemberUpdate.TypeConverter.cs | 142 + .../BlockchainMemberUpdate.cs | 108 + .../BlockchainMemberUpdate.json.cs | 105 + .../BlockchainMemberUpdateTags.PowerShell.cs | 137 + ...lockchainMemberUpdateTags.TypeConverter.cs | 142 + .../BlockchainMemberUpdateTags.cs | 32 + .../BlockchainMemberUpdateTags.dictionary.cs | 70 + .../BlockchainMemberUpdateTags.json.cs | 104 + .../Consortium.PowerShell.cs | 133 + .../Consortium.TypeConverter.cs | 142 + .../Models/Api20180601Preview/Consortium.cs | 63 + .../Api20180601Preview/Consortium.json.cs | 103 + .../ConsortiumCollection.PowerShell.cs | 133 + .../ConsortiumCollection.TypeConverter.cs | 142 + .../ConsortiumCollection.cs | 46 + .../ConsortiumCollection.json.cs | 109 + .../ConsortiumMember.PowerShell.cs | 143 + .../ConsortiumMember.TypeConverter.cs | 142 + .../Api20180601Preview/ConsortiumMember.cs | 148 + .../ConsortiumMember.json.cs | 113 + .../ConsortiumMemberCollection.PowerShell.cs | 135 + ...onsortiumMemberCollection.TypeConverter.cs | 142 + .../ConsortiumMemberCollection.cs | 73 + .../ConsortiumMemberCollection.json.cs | 111 + .../FirewallRule.PowerShell.cs | 135 + .../FirewallRule.TypeConverter.cs | 142 + .../Models/Api20180601Preview/FirewallRule.cs | 80 + .../Api20180601Preview/FirewallRule.json.cs | 105 + .../NameAvailability.PowerShell.cs | 137 + .../NameAvailability.TypeConverter.cs | 142 + .../Api20180601Preview/NameAvailability.cs | 82 + .../NameAvailability.json.cs | 107 + .../NameAvailabilityRequest.PowerShell.cs | 137 + .../NameAvailabilityRequest.TypeConverter.cs | 142 + .../NameAvailabilityRequest.cs | 65 + .../NameAvailabilityRequest.json.cs | 105 + .../OperationResult.PowerShell.cs | 137 + .../OperationResult.TypeConverter.cs | 142 + .../Api20180601Preview/OperationResult.cs | 82 + .../OperationResult.json.cs | 107 + .../Api20180601Preview/Resource.PowerShell.cs | 135 + .../Resource.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/Resource.cs | 89 + .../Api20180601Preview/Resource.json.cs | 114 + .../ResourceProviderOperation.PowerShell.cs | 147 + ...ResourceProviderOperation.TypeConverter.cs | 142 + .../ResourceProviderOperation.cs | 148 + .../ResourceProviderOperation.json.cs | 107 + ...eProviderOperationCollection.PowerShell.cs | 137 + ...oviderOperationCollection.TypeConverter.cs | 143 + .../ResourceProviderOperationCollection.cs | 75 + ...esourceProviderOperationCollection.json.cs | 114 + ...urceProviderOperationDisplay.PowerShell.cs | 141 + ...eProviderOperationDisplay.TypeConverter.cs | 142 + .../ResourceProviderOperationDisplay.cs | 99 + .../ResourceProviderOperationDisplay.json.cs | 109 + .../ResourceTypeSku.PowerShell.cs | 133 + .../ResourceTypeSku.TypeConverter.cs | 142 + .../Api20180601Preview/ResourceTypeSku.cs | 63 + .../ResourceTypeSku.json.cs | 111 + .../ResourceTypeSkuCollection.PowerShell.cs | 133 + ...ResourceTypeSkuCollection.TypeConverter.cs | 142 + .../ResourceTypeSkuCollection.cs | 46 + .../ResourceTypeSkuCollection.json.cs | 109 + .../Api20180601Preview/Sku.PowerShell.cs | 133 + .../Api20180601Preview/Sku.TypeConverter.cs | 142 + .../api/Models/Api20180601Preview/Sku.cs | 63 + .../api/Models/Api20180601Preview/Sku.json.cs | 103 + .../SkuSetting.PowerShell.cs | 137 + .../SkuSetting.TypeConverter.cs | 142 + .../Models/Api20180601Preview/SkuSetting.cs | 97 + .../Api20180601Preview/SkuSetting.json.cs | 123 + .../TrackedResource.PowerShell.cs | 139 + .../TrackedResource.TypeConverter.cs | 142 + .../Api20180601Preview/TrackedResource.cs | 109 + .../TrackedResource.json.cs | 105 + .../TrackedResourceTags.PowerShell.cs | 137 + .../TrackedResourceTags.TypeConverter.cs | 142 + .../Api20180601Preview/TrackedResourceTags.cs | 32 + .../TrackedResourceTags.dictionary.cs | 70 + .../TrackedResourceTags.json.cs | 104 + .../TransactionNode.PowerShell.cs | 153 + .../TransactionNode.TypeConverter.cs | 142 + .../Api20180601Preview/TransactionNode.cs | 196 + .../TransactionNode.json.cs | 107 + .../TransactionNodeCollection.PowerShell.cs | 137 + ...TransactionNodeCollection.TypeConverter.cs | 142 + .../TransactionNodeCollection.cs | 75 + .../TransactionNodeCollection.json.cs | 113 + .../TransactionNodeProperties.PowerShell.cs | 143 + ...TransactionNodeProperties.TypeConverter.cs | 142 + .../TransactionNodeProperties.cs | 143 + .../TransactionNodeProperties.json.cs | 131 + ...nsactionNodePropertiesUpdate.PowerShell.cs | 137 + ...ctionNodePropertiesUpdate.TypeConverter.cs | 142 + .../TransactionNodePropertiesUpdate.cs | 65 + .../TransactionNodePropertiesUpdate.json.cs | 113 + .../TransactionNodeUpdate.PowerShell.cs | 139 + .../TransactionNodeUpdate.TypeConverter.cs | 142 + .../TransactionNodeUpdate.cs | 71 + .../TransactionNodeUpdate.json.cs | 103 + .../Models/BlockchainIdentity.PowerShell.cs | 146 + .../BlockchainIdentity.TypeConverter.cs | 157 + .../api/Models/BlockchainIdentity.cs | 168 + .../api/Models/BlockchainIdentity.json.cs | 117 + ...kchainMemberProvisioningState.Completer.cs | 55 + ...inMemberProvisioningState.TypeConverter.cs | 59 + .../BlockchainMemberProvisioningState.cs | 111 + .../Support/BlockchainProtocol.Completer.cs | 47 + .../BlockchainProtocol.TypeConverter.cs | 59 + .../api/Support/BlockchainProtocol.cs | 101 + .../NameAvailabilityReason.Completer.cs | 43 + .../NameAvailabilityReason.TypeConverter.cs | 59 + .../api/Support/NameAvailabilityReason.cs | 99 + .../NodeProvisioningState.Completer.cs | 51 + .../NodeProvisioningState.TypeConverter.cs | 59 + .../api/Support/NodeProvisioningState.cs | 103 + .../cmdlets/GetAzBlockchainConsortium_List.cs | 337 ++ .../GetAzBlockchainMemberApiKey_List.cs | 354 ++ ...AzBlockchainMemberConsortiumMember_List.cs | 361 ++ .../cmdlets/GetAzBlockchainMember_Get.cs | 351 ++ .../GetAzBlockchainMember_GetViaIdentity.cs | 323 ++ .../cmdlets/GetAzBlockchainMember_List.cs | 347 ++ .../cmdlets/GetAzBlockchainMember_List1.cs | 330 ++ .../cmdlets/GetAzBlockchainOperation_List.cs | 307 ++ .../cmdlets/GetAzBlockchainSku_List.cs | 320 ++ ...tAzBlockchainTransactionNodeApiKey_List.cs | 368 ++ .../GetAzBlockchainTransactionNode_Get.cs | 365 ++ ...lockchainTransactionNode_GetViaIdentity.cs | 327 ++ .../GetAzBlockchainTransactionNode_List.cs | 361 ++ ...ockchainMemberApiKey_RegenerateExpanded.cs | 381 ++ ...berApiKey_RegenerateViaIdentityExpanded.cs | 357 ++ .../NewAzBlockchainMember_CreateExpanded.cs | 564 +++ ...ransactionNodeApiKey_RegenerateExpanded.cs | 395 ++ ...odeApiKey_RegenerateViaIdentityExpanded.cs | 362 ++ ...lockchainTransactionNode_CreateExpanded.cs | 476 ++ .../RemoveAzBlockchainMember_Delete.cs | 422 ++ ...oveAzBlockchainMember_DeleteViaIdentity.cs | 394 ++ ...emoveAzBlockchainTransactionNode_Delete.cs | 437 ++ ...kchainTransactionNode_DeleteViaIdentity.cs | 398 ++ ...nLocationNameAvailability_CheckExpanded.cs | 363 ++ ...UpdateAzBlockchainMember_UpdateExpanded.cs | 408 ++ ...ckchainMember_UpdateViaIdentityExpanded.cs | 383 ++ ...lockchainTransactionNode_UpdateExpanded.cs | 397 ++ ...ansactionNode_UpdateViaIdentityExpanded.cs | 362 ++ .../generated/runtime/AsyncCommandRuntime.cs | 828 ++++ src/Blockchain/generated/runtime/AsyncJob.cs | 270 ++ .../runtime/AsyncOperationResponse.cs | 177 + .../BuildTime/Cmdlets/ExportCmdletSurface.cs | 113 + .../BuildTime/Cmdlets/ExportExampleStub.cs | 74 + .../BuildTime/Cmdlets/ExportFormatPs1xml.cs | 99 + .../BuildTime/Cmdlets/ExportHelpMarkdown.cs | 53 + .../BuildTime/Cmdlets/ExportModelSurface.cs | 117 + .../BuildTime/Cmdlets/ExportProxyCmdlet.cs | 159 + .../runtime/BuildTime/Cmdlets/ExportPsd1.cs | 125 + .../BuildTime/Cmdlets/ExportTestStub.cs | 137 + .../BuildTime/Cmdlets/GetCommonParameter.cs | 52 + .../BuildTime/Cmdlets/GetModuleGuid.cs | 31 + .../BuildTime/Cmdlets/GetScriptCmdlet.cs | 53 + .../runtime/BuildTime/CollectionExtensions.cs | 20 + .../runtime/BuildTime/MarkdownRenderer.cs | 121 + .../runtime/BuildTime/Models/PsFormatTypes.cs | 138 + .../BuildTime/Models/PsHelpMarkdownOutputs.cs | 177 + .../runtime/BuildTime/Models/PsHelpTypes.cs | 199 + .../BuildTime/Models/PsMarkdownTypes.cs | 291 ++ .../BuildTime/Models/PsProxyOutputs.cs | 513 +++ .../runtime/BuildTime/Models/PsProxyTypes.cs | 499 +++ .../runtime/BuildTime/PsAttributes.cs | 114 + .../runtime/BuildTime/PsExtensions.cs | 160 + .../generated/runtime/BuildTime/PsHelpers.cs | 104 + .../runtime/BuildTime/StringExtensions.cs | 24 + .../runtime/BuildTime/XmlExtensions.cs | 28 + .../generated/runtime/CmdInfoHandler.cs | 40 + .../Conversions/ConversionException.cs | 17 + .../runtime/Conversions/IJsonConverter.cs | 13 + .../Conversions/Instances/BinaryConverter.cs | 24 + .../Conversions/Instances/BooleanConverter.cs | 13 + .../Instances/DateTimeConverter.cs | 18 + .../Instances/DateTimeOffsetConverter.cs | 15 + .../Conversions/Instances/DecimalConverter.cs | 16 + .../Conversions/Instances/DoubleConverter.cs | 13 + .../Conversions/Instances/EnumConverter.cs | 30 + .../Conversions/Instances/GuidConverter.cs | 15 + .../Instances/HashSet'1Converter.cs | 27 + .../Conversions/Instances/Int16Converter.cs | 13 + .../Conversions/Instances/Int32Converter.cs | 13 + .../Conversions/Instances/Int64Converter.cs | 13 + .../Instances/JsonArrayConverter.cs | 13 + .../Instances/JsonObjectConverter.cs | 13 + .../Conversions/Instances/SingleConverter.cs | 13 + .../Conversions/Instances/StringConverter.cs | 13 + .../Instances/TimeSpanConverter.cs | 15 + .../Conversions/Instances/UInt16Converter.cs | 13 + .../Conversions/Instances/UInt32Converter.cs | 13 + .../Conversions/Instances/UInt64Converter.cs | 13 + .../Conversions/Instances/UriConverter.cs | 15 + .../runtime/Conversions/JsonConverter.cs | 21 + .../Conversions/JsonConverterAttribute.cs | 18 + .../Conversions/JsonConverterFactory.cs | 91 + .../Conversions/StringLikeConverter.cs | 45 + .../Customizations/IJsonSerializable.cs | 249 ++ .../runtime/Customizations/JsonArray.cs | 13 + .../runtime/Customizations/JsonBoolean.cs | 16 + .../runtime/Customizations/JsonNode.cs | 21 + .../runtime/Customizations/JsonNumber.cs | 78 + .../runtime/Customizations/JsonObject.cs | 183 + .../runtime/Customizations/JsonString.cs | 34 + .../runtime/Customizations/XNodeArray.cs | 44 + src/Blockchain/generated/runtime/Debugging.cs | 28 + .../generated/runtime/DictionaryExtensions.cs | 36 + src/Blockchain/generated/runtime/EventData.cs | 78 + .../generated/runtime/EventDataExtensions.cs | 94 + .../generated/runtime/EventListener.cs | 247 ++ src/Blockchain/generated/runtime/Events.cs | 27 + .../generated/runtime/EventsExtensions.cs | 27 + .../generated/runtime/Extensions.cs | 111 + .../Extensions/StringBuilderExtensions.cs | 23 + .../Helpers/Extensions/TypeExtensions.cs | 61 + .../generated/runtime/Helpers/Seperator.cs | 11 + .../generated/runtime/Helpers/TypeDetails.cs | 116 + .../generated/runtime/Helpers/XHelper.cs | 75 + .../generated/runtime/HttpPipeline.cs | 88 + .../generated/runtime/HttpPipelineMocking.ps1 | 110 + .../generated/runtime/IAssociativeArray.cs | 21 + .../generated/runtime/IHeaderSerializable.cs | 14 + .../generated/runtime/ISendAsync.cs | 289 ++ .../generated/runtime/InfoAttribute.cs | 34 + .../generated/runtime/Iso/IsoDate.cs | 214 + src/Blockchain/generated/runtime/JsonType.cs | 18 + src/Blockchain/generated/runtime/Method.cs | 19 + .../generated/runtime/Models/JsonMember.cs | 83 + .../generated/runtime/Models/JsonModel.cs | 89 + .../runtime/Models/JsonModelCache.cs | 19 + .../runtime/Nodes/Collections/JsonArray.cs | 65 + .../Nodes/Collections/XImmutableArray.cs | 62 + .../runtime/Nodes/Collections/XList.cs | 64 + .../runtime/Nodes/Collections/XNodeArray.cs | 68 + .../runtime/Nodes/Collections/XSet.cs | 60 + .../generated/runtime/Nodes/JsonBoolean.cs | 42 + .../generated/runtime/Nodes/JsonDate.cs | 173 + .../generated/runtime/Nodes/JsonNode.cs | 250 ++ .../generated/runtime/Nodes/JsonNumber.cs | 109 + .../generated/runtime/Nodes/JsonObject.cs | 172 + .../generated/runtime/Nodes/JsonString.cs | 42 + .../generated/runtime/Nodes/XBinary.cs | 40 + .../generated/runtime/Nodes/XNull.cs | 15 + .../Parser/Exceptions/ParseException.cs | 24 + .../generated/runtime/Parser/JsonParser.cs | 180 + .../generated/runtime/Parser/JsonToken.cs | 66 + .../generated/runtime/Parser/JsonTokenizer.cs | 177 + .../generated/runtime/Parser/Location.cs | 43 + .../runtime/Parser/Readers/SourceReader.cs | 130 + .../generated/runtime/Parser/TokenReader.cs | 39 + .../generated/runtime/PipelineMocking.cs | 254 ++ src/Blockchain/generated/runtime/Response.cs | 27 + .../runtime/Serialization/JsonSerializer.cs | 350 ++ .../Serialization/PropertyTransformation.cs | 21 + .../Serialization/SerializationOptions.cs | 65 + .../generated/runtime/SerializationMode.cs | 16 + .../runtime/TypeConverterExtensions.cs | 190 + .../runtime/UndeclaredResponseException.cs | 104 + .../generated/runtime/Writers/JsonWriter.cs | 223 + src/Blockchain/generated/runtime/delegates.cs | 23 + src/Blockchain/help/Az.Blockchain.md | 61 + .../help/Get-AzBlockchainConsortium.md | 126 + src/Blockchain/help/Get-AzBlockchainMember.md | 201 + .../help/Get-AzBlockchainMemberApiKey.md | 146 + .../Get-AzBlockchainMemberConsortiumMember.md | 114 + src/Blockchain/help/Get-AzBlockchainSku.md | 79 + .../help/Get-AzBlockchainTransactionNode.md | 197 + .../Get-AzBlockchainTransactionNodeApiKey.md | 162 + src/Blockchain/help/New-AzBlockchainMember.md | 372 ++ .../help/New-AzBlockchainMemberApiKey.md | 231 + .../help/New-AzBlockchainTransactionNode.md | 248 ++ .../New-AzBlockchainTransactionNodeApiKey.md | 246 ++ .../help/Remove-AzBlockchainMember.md | 235 + .../Remove-AzBlockchainTransactionNode.md | 250 ++ ...st-AzBlockchainLocationNameAvailability.md | 170 + .../help/Update-AzBlockchainMember.md | 268 ++ .../Update-AzBlockchainTransactionNode.md | 250 ++ src/Blockchain/how-to.md | 58 + .../internal/Az.Blockchain.internal.psm1 | 38 + .../internal/Get-AzBlockchainOperation.ps1 | 121 + .../internal/New-AzBlockchainMember.ps1 | 242 ++ .../New-AzBlockchainTransactionNode.ps1 | 191 + .../internal/ProxyCmdletDefinitions.ps1 | 961 +++++ .../internal/Update-AzBlockchainMember.ps1 | 207 + .../Update-AzBlockchainTransactionNode.ps1 | 200 + src/Blockchain/internal/readme.md | 14 + src/Blockchain/pack-module.ps1 | 16 + src/Blockchain/readme.md | 121 + src/Blockchain/run-module.ps1 | 59 + src/Blockchain/test-module.ps1 | 68 + .../Get-AzBlockchainConsortium.Recording.json | 41 + .../test/Get-AzBlockchainConsortium.Tests.ps1 | 20 + .../Get-AzBlockchainMember.Recording.json | 197 + .../test/Get-AzBlockchainMember.Tests.ps1 | 37 + ...et-AzBlockchainMemberApiKey.Recording.json | 41 + .../Get-AzBlockchainMemberApiKey.Tests.ps1 | 19 + ...chainMemberConsortiumMember.Recording.json | 41 + ...BlockchainMemberConsortiumMember.Tests.ps1 | 19 + .../test/Get-AzBlockchainSku.Recording.json | 40 + .../test/Get-AzBlockchainSku.Tests.ps1 | 18 + ...AzBlockchainTransactionNode.Recording.json | 158 + .../Get-AzBlockchainTransactionNode.Tests.ps1 | 32 + ...kchainTransactionNodeApiKey.Recording.json | 41 + ...zBlockchainTransactionNodeApiKey.Tests.ps1 | 19 + .../New-AzBlockchainMember.Recording.json | 660 +++ .../test/New-AzBlockchainMember.Tests.ps1 | 23 + ...ew-AzBlockchainMemberApiKey.Recording.json | 187 + .../New-AzBlockchainMemberApiKey.Tests.ps1 | 32 + ...AzBlockchainTransactionNode.Recording.json | 582 +++ .../New-AzBlockchainTransactionNode.Tests.ps1 | 22 + ...kchainTransactionNodeApiKey.Recording.json | 187 + ...zBlockchainTransactionNodeApiKey.Tests.ps1 | 31 + .../Remove-AzBlockchainMember.Recording.json | 2325 ++++++++++ .../test/Remove-AzBlockchainMember.Tests.ps1 | 34 + ...AzBlockchainTransactionNode.Recording.json | 1406 ++++++ ...move-AzBlockchainTransactionNode.Tests.ps1 | 33 + ...ainLocationNameAvailability.Recording.json | 70 + ...ockchainLocationNameAvailability.Tests.ps1 | 22 + .../Update-AzBlockchainMember.Recording.json | 255 ++ .../test/Update-AzBlockchainMember.Tests.ps1 | 34 + ...AzBlockchainTransactionNode.Recording.json | 109 + ...date-AzBlockchainTransactionNode.Tests.ps1 | 30 + src/Blockchain/test/env.json | 17 + src/Blockchain/test/loadEnv.ps1 | 28 + src/Blockchain/test/readme.md | 17 + src/Blockchain/test/utils.ps1 | 57 + 409 files changed, 63314 insertions(+) create mode 100644 src/Blockchain/Az.BlockChain.format.ps1xml create mode 100644 src/Blockchain/Az.BlockChain.psd1 create mode 100644 src/Blockchain/Az.BlockChain.psm1 create mode 100644 src/Blockchain/MSSharedLibKey.snk create mode 100644 src/Blockchain/build-module.ps1 create mode 100644 src/Blockchain/check-dependencies.ps1 create mode 100644 src/Blockchain/custom/Az.Blockchain.custom.psm1 create mode 100644 src/Blockchain/custom/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/custom/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/custom/readme.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainConsortium.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainSku.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/examples/New-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/New-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/examples/New-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/examples/Remove-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md create mode 100644 src/Blockchain/examples/Update-AzBlockchainMember.md create mode 100644 src/Blockchain/examples/Update-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/export-surface.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainSku.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 create mode 100644 src/Blockchain/exports/ProxyCmdletDefinitions.ps1 create mode 100644 src/Blockchain/exports/Remove-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 create mode 100644 src/Blockchain/exports/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/exports/readme.md create mode 100644 src/Blockchain/generate-help.ps1 create mode 100644 src/Blockchain/generate-info.json create mode 100644 src/Blockchain/generated/Module.cs create mode 100644 src/Blockchain/generated/api/Blockchain.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs create mode 100644 src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.cs create mode 100644 src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/BlockchainProtocol.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/NameAvailabilityReason.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs create mode 100644 src/Blockchain/generated/api/Support/NodeProvisioningState.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs create mode 100644 src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs create mode 100644 src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs create mode 100644 src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs create mode 100644 src/Blockchain/generated/runtime/AsyncCommandRuntime.cs create mode 100644 src/Blockchain/generated/runtime/AsyncJob.cs create mode 100644 src/Blockchain/generated/runtime/AsyncOperationResponse.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs create mode 100644 src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs create mode 100644 src/Blockchain/generated/runtime/CmdInfoHandler.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/ConversionException.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverter.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs create mode 100644 src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonArray.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonNode.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonNumber.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonObject.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/JsonString.cs create mode 100644 src/Blockchain/generated/runtime/Customizations/XNodeArray.cs create mode 100644 src/Blockchain/generated/runtime/Debugging.cs create mode 100644 src/Blockchain/generated/runtime/DictionaryExtensions.cs create mode 100644 src/Blockchain/generated/runtime/EventData.cs create mode 100644 src/Blockchain/generated/runtime/EventDataExtensions.cs create mode 100644 src/Blockchain/generated/runtime/EventListener.cs create mode 100644 src/Blockchain/generated/runtime/Events.cs create mode 100644 src/Blockchain/generated/runtime/EventsExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Extensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/Seperator.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/TypeDetails.cs create mode 100644 src/Blockchain/generated/runtime/Helpers/XHelper.cs create mode 100644 src/Blockchain/generated/runtime/HttpPipeline.cs create mode 100644 src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 create mode 100644 src/Blockchain/generated/runtime/IAssociativeArray.cs create mode 100644 src/Blockchain/generated/runtime/IHeaderSerializable.cs create mode 100644 src/Blockchain/generated/runtime/ISendAsync.cs create mode 100644 src/Blockchain/generated/runtime/InfoAttribute.cs create mode 100644 src/Blockchain/generated/runtime/Iso/IsoDate.cs create mode 100644 src/Blockchain/generated/runtime/JsonType.cs create mode 100644 src/Blockchain/generated/runtime/Method.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonMember.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonModel.cs create mode 100644 src/Blockchain/generated/runtime/Models/JsonModelCache.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XList.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonDate.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonNode.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonNumber.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonObject.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/JsonString.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/XBinary.cs create mode 100644 src/Blockchain/generated/runtime/Nodes/XNull.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonParser.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonToken.cs create mode 100644 src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Location.cs create mode 100644 src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs create mode 100644 src/Blockchain/generated/runtime/Parser/TokenReader.cs create mode 100644 src/Blockchain/generated/runtime/PipelineMocking.cs create mode 100644 src/Blockchain/generated/runtime/Response.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs create mode 100644 src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs create mode 100644 src/Blockchain/generated/runtime/SerializationMode.cs create mode 100644 src/Blockchain/generated/runtime/TypeConverterExtensions.cs create mode 100644 src/Blockchain/generated/runtime/UndeclaredResponseException.cs create mode 100644 src/Blockchain/generated/runtime/Writers/JsonWriter.cs create mode 100644 src/Blockchain/generated/runtime/delegates.cs create mode 100644 src/Blockchain/help/Az.Blockchain.md create mode 100644 src/Blockchain/help/Get-AzBlockchainConsortium.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md create mode 100644 src/Blockchain/help/Get-AzBlockchainSku.md create mode 100644 src/Blockchain/help/Get-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/help/New-AzBlockchainMember.md create mode 100644 src/Blockchain/help/New-AzBlockchainMemberApiKey.md create mode 100644 src/Blockchain/help/New-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md create mode 100644 src/Blockchain/help/Remove-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Remove-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md create mode 100644 src/Blockchain/help/Update-AzBlockchainMember.md create mode 100644 src/Blockchain/help/Update-AzBlockchainTransactionNode.md create mode 100644 src/Blockchain/how-to.md create mode 100644 src/Blockchain/internal/Az.Blockchain.internal.psm1 create mode 100644 src/Blockchain/internal/Get-AzBlockchainOperation.ps1 create mode 100644 src/Blockchain/internal/New-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/internal/ProxyCmdletDefinitions.ps1 create mode 100644 src/Blockchain/internal/Update-AzBlockchainMember.ps1 create mode 100644 src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 create mode 100644 src/Blockchain/internal/readme.md create mode 100644 src/Blockchain/pack-module.ps1 create mode 100644 src/Blockchain/readme.md create mode 100644 src/Blockchain/run-module.ps1 create mode 100644 src/Blockchain/test-module.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainSku.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json create mode 100644 src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json create mode 100644 src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 create mode 100644 src/Blockchain/test/Remove-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json create mode 100644 src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 create mode 100644 src/Blockchain/test/Update-AzBlockchainMember.Recording.json create mode 100644 src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 create mode 100644 src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json create mode 100644 src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 create mode 100644 src/Blockchain/test/env.json create mode 100644 src/Blockchain/test/loadEnv.ps1 create mode 100644 src/Blockchain/test/readme.md create mode 100644 src/Blockchain/test/utils.ps1 diff --git a/src/Blockchain/Az.BlockChain.format.ps1xml b/src/Blockchain/Az.BlockChain.format.ps1xml new file mode 100644 index 000000000000..976f63ced768 --- /dev/null +++ b/src/Blockchain/Az.BlockChain.format.ps1xml @@ -0,0 +1,933 @@ + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.BlockchainIdentity + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.BlockchainIdentity + + + + + + + + + + + + + + + + + + + + + + + + + + + BlockchainMemberName + + + Location + + + OperationId + + + ResourceGroupName + + + SubscriptionId + + + TransactionNodeName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey + + + + + + + + + + + + + + + KeyName + + + Value + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember + + + + + + + + + + + + + + + + + + Location + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku + + + + + + + + + + + + Capacity + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Consortium + + + ConsortiumManagementAccountAddress + + + ConsortiumManagementAccountPassword + + + ConsortiumMemberDisplayName + + + ConsortiumRole + + + Dns + + + Password + + + Protocol + + + ProvisioningState + + + PublicKey + + + RootContractAddress + + + UserName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate + + + + + + + + + + + + + + + Password + + + ConsortiumManagementAccountPassword + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium + + + + + + + + + + + + + + + Name + + + Protocol + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DateModified + + + DisplayName + + + JoinDate + + + Name + + + Role + + + Status + + + SubscriptionId + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule + + + + + + + + + + + + + + + + + + EndIPAddress + + + RuleName + + + StartIPAddress + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability + + + + + + + + + + + + + + + + + + Message + + + NameAvailable + + + Reason + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult + + + + + + + + + + + + + + + + + + EndTime + + + Name + + + StartTime + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource + + + + + + + + + + + + + + + Name + + + Type + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation + + + + + + + + + + + + + + + + + + IsDataAction + + + Name + + + Origin + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay + + + + + + + + + + + + + + + + + + + + + Description + + + Operation + + + Provider + + + Resource + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku + + + + + + + + + + + + ResourceType + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku + + + + + + + + + + + + + + + Name + + + Tier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting + + + + + + + + + + + + + + + + + + + + + Location + + + Name + + + RequiredFeature + + + Tier + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource + + + + + + + + + + + + + + + + + + Name + + + Type + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags + + + + + + + + + + + + Item + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode + + + + + + + + + + + + + + + + + + Name + + + Type + + + Location + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection + + + + + + + + + + + + NextLink + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties + + + + + + + + + + + + + + + + + + + + + + + + Dns + + + Password + + + ProvisioningState + + + PublicKey + + + UserName + + + + + + + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate + + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate + + + + + + + + + + + + Password + + + + + + + + \ No newline at end of file diff --git a/src/Blockchain/Az.BlockChain.psd1 b/src/Blockchain/Az.BlockChain.psd1 new file mode 100644 index 000000000000..7813ba0ae211 --- /dev/null +++ b/src/Blockchain/Az.BlockChain.psd1 @@ -0,0 +1,24 @@ +@{ + GUID = 'ae1a09bf-916c-480c-a1bb-bace1453a91e' + RootModule = './Az.Blockchain.psm1' + ModuleVersion = '0.1.0' + CompatiblePSEditions = 'Core', 'Desktop' + Author = 'Microsoft Corporation' + CompanyName = 'Microsoft Corporation' + Copyright = 'Microsoft Corporation. All rights reserved.' + Description = 'Microsoft Azure PowerShell: Blockchain cmdlets' + PowerShellVersion = '5.1' + DotNetFrameworkVersion = '4.7.2' + RequiredAssemblies = './bin/Az.Blockchain.private.dll' + FormatsToProcess = './Az.Blockchain.format.ps1xml' + FunctionsToExport = 'Get-AzBlockchainConsortium', 'Get-AzBlockchainMember', 'Get-AzBlockchainMemberApiKey', 'Get-AzBlockchainMemberConsortiumMember', 'Get-AzBlockchainSku', 'Get-AzBlockchainTransactionNode', 'Get-AzBlockchainTransactionNodeApiKey', 'New-AzBlockchainMember', 'New-AzBlockchainMemberApiKey', 'New-AzBlockchainTransactionNode', 'New-AzBlockchainTransactionNodeApiKey', 'Remove-AzBlockchainMember', 'Remove-AzBlockchainTransactionNode', 'Test-AzBlockchainLocationNameAvailability', 'Update-AzBlockchainMember', 'Update-AzBlockchainTransactionNode', '*' + AliasesToExport = '*' + PrivateData = @{ + PSData = @{ + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'Blockchain' + LicenseUri = 'https://aka.ms/azps-license' + ProjectUri = 'https://github.com/Azure/azure-powershell' + ReleaseNotes = '' + } + } +} diff --git a/src/Blockchain/Az.BlockChain.psm1 b/src/Blockchain/Az.BlockChain.psm1 new file mode 100644 index 000000000000..e6650cff834c --- /dev/null +++ b/src/Blockchain/Az.BlockChain.psm1 @@ -0,0 +1,109 @@ +# region Generated + # ---------------------------------------------------------------------------------- + # + # Copyright Microsoft Corporation + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # http://www.apache.org/licenses/LICENSE-2.0 + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + # ---------------------------------------------------------------------------------- + # Load required Az.Accounts module + $accountsName = 'Az.Accounts' + $accountsModule = Get-Module -Name $accountsName + if(-not $accountsModule) { + $localAccountsPath = Join-Path $PSScriptRoot 'generated\modules' + if(Test-Path -Path $localAccountsPath) { + $localAccounts = Get-ChildItem -Path $localAccountsPath -Recurse -Include 'Az.Accounts.psd1' | Select-Object -Last 1 + if($localAccounts) { + $accountsModule = Import-Module -Name ($localAccounts.FullName) -Scope Global -PassThru + } + } + if(-not $accountsModule) { + $hasAdequateVersion = (Get-Module -Name $accountsName -ListAvailable | Where-Object { $_.Version -ge [System.Version]'1.7.4' } | Measure-Object).Count -gt 0 + if($hasAdequateVersion) { + $accountsModule = Import-Module -Name $accountsName -MinimumVersion 1.7.4 -Scope Global -PassThru + } + } + } + + if(-not $accountsModule) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. For installation instructions, please see: https://docs.microsoft.com/en-us/powershell/azure/install-az-ps" -ErrorAction Stop + } elseif (($accountsModule.Version -lt [System.Version]'1.7.4') -and (-not $localAccounts)) { + Write-Error "`nThis module requires $accountsName version 1.7.4 or greater. An earlier version of Az.Accounts is imported in the current PowerShell session. If you are running test, please try to remove '.PSSharedModules' in your home directory. Otherwise please open a new PowerShell session and import this module again.`nAdditionally, this error could indicate that multiple incompatible versions of Azure PowerShell modules are installed on your system. For troubleshooting information, please see: https://aka.ms/azps-version-error" -ErrorAction Stop + } + Write-Information "Loaded Module '$($accountsModule.Name)'" + + # Load the private module dll + $null = Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Blockchain.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance + + # Ask for the shared functionality table + $VTable = Register-AzModule + + # Tweaks the pipeline on module load + $instance.OnModuleLoad = $VTable.OnModuleLoad + + # Tweaks the pipeline per call + $instance.OnNewRequest = $VTable.OnNewRequest + + # Gets shared parameter values + $instance.GetParameterValue = $VTable.GetParameterValue + + # Allows shared module to listen to events from this module + $instance.EventListener = $VTable.EventListener + + # Gets shared argument completers + $instance.ArgumentCompleter = $VTable.ArgumentCompleter + + # The name of the currently selected Azure profile + $instance.ProfileName = $VTable.ProfileName + + + # Load the custom module + $customModulePath = Join-Path $PSScriptRoot './custom/Az.Blockchain.custom.psm1' + if(Test-Path $customModulePath) { + $null = Import-Module -Name $customModulePath + } + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = Join-Path $PSScriptRoot './exports' + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } + + # Finalize initialization of this module + $instance.Init(); + Write-Information "Loaded Module '$($instance.Name)'" +# endregion diff --git a/src/Blockchain/MSSharedLibKey.snk b/src/Blockchain/MSSharedLibKey.snk new file mode 100644 index 0000000000000000000000000000000000000000..695f1b38774e839e5b90059bfb7f32df1dff4223 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50098C{E+7Ye`kjtcRG*W zi8#m|)B?I?xgZ^2Sw5D;l4TxtPwG;3)3^j?qDHjEteSTF{rM+4WI`v zCD?tsZ^;k+S&r1&HRMb=j738S=;J$tCKNrc$@P|lZ: Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $null = $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $null = $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') + $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) + } + if ($PSBoundParameters.ContainsKey('Sku')) { + $PSBoundParameters.Add('SkuName', $PSBoundParameters['Sku']) + $null = $PSBoundParameters.Remove('Sku') + } + Az.Blockchain.internal\New-AzBlockchainMember @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..b0fef07d39d5 --- /dev/null +++ b/src/Blockchain/custom/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,148 @@ +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + + + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + Az.Blockchain.internal\New-AzBlockchainTransactionNode @PSBoundParameters + } catch { + throw + } +} + +} diff --git a/src/Blockchain/custom/Update-AzBlockchainMember.ps1 b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..63d29ab41e69 --- /dev/null +++ b/src/Blockchain/custom/Update-AzBlockchainMember.ps1 @@ -0,0 +1,158 @@ +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + if ($PSBoundParameters.ContainsKey('ConsortiumManagementAccountPassword')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['ConsortiumManagementAccountPassword'])) + $PSBoundParameters.Remove('ConsortiumManagementAccountPassword') + $PSBoundParameters.Add('ConsortiumManagementAccountPassword', $psTxt) + } + Az.Blockchain.internal\Update-AzBlockchainMember @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..50dcb18f7493 --- /dev/null +++ b/src/Blockchain/custom/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,145 @@ +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +To view examples, please use the -Online parameter with Get-Help or navigate to: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + [ValidateNotNullOrEmpty()] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +process { + try { + if ($PSBoundParameters.ContainsKey('Password')) { + $psTxt = [System.Runtime.InteropServices.marshal]::PtrToStringAuto([System.Runtime.InteropServices.marshal]::SecureStringToBSTR($PSBoundParameters['Password'])) + $PSBoundParameters.Remove('Password') + $PSBoundParameters.Add('Password', $psTxt) + } + Az.Blockchain.internal\Update-AzBlockchainTransactionNode @PSBoundParameters + } catch { + throw + } +} +} diff --git a/src/Blockchain/custom/readme.md b/src/Blockchain/custom/readme.md new file mode 100644 index 000000000000..e3cf700a8043 --- /dev/null +++ b/src/Blockchain/custom/readme.md @@ -0,0 +1,41 @@ +# Custom +This directory contains custom implementation for non-generated cmdlets for the `Az.Blockchain` module. Both scripts (`.ps1`) and C# files (`.cs`) can be implemented here. They will be used during the build process in `build-module.ps1`, and create cmdlets into the `..\exports` folder. The only generated file into this folder is the `Az.Blockchain.custom.psm1`. This file should not be modified. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: yes + +## Details +For `Az.Blockchain` to use custom cmdlets, it does this two different ways. We **highly recommend** creating script cmdlets, as they are easier to write and allow access to the other exported cmdlets. C# cmdlets *cannot access exported cmdlets*. + +For C# cmdlets, they are compiled with the rest of the generated low-level cmdlets into the `./bin/Az.Blockchain.private.dll`. The names of the cmdlets (methods) and files must follow the `[cmdletName]_[variantName]` syntax used for generated cmdlets. The `variantName` is used as the `ParameterSetName`, so use something appropriate that doesn't clash with already created variant or parameter set names. You cannot use the `ParameterSetName` property in the `Parameter` attribute on C# cmdlets. Each cmdlet must be separated into variants using the same pattern as seen in the `generated/cmdlets` folder. + +For script cmdlets, these are loaded via the `Az.Blockchain.custom.psm1`. Then, during the build process, this module is loaded and processed in the same manner as the C# cmdlets. The fundemental difference is the script cmdlets use the `ParameterSetName` attribute and C# cmdlets do not. To create a script cmdlet variant of a generated cmdlet, simply decorate all parameters in the script with the new `ParameterSetName` in the `Parameter` attribute. This will appropriately treat each parameter set as a separate variant when processed to be exported during the build. + +## Purpose +This allows the modules to have cmdlets that were not defined in the REST specification. It also allows combining logic using generated cmdlets. This is a level of customization beyond what can be done using the [readme configuration options](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md) that are currently available. These custom cmdlets are then referenced by the cmdlets created at build-time in the `..\exports` folder. + +## Usage +The easiest way currently to start developing custom cmdlets is to copy an existing cmdlet. For C# cmdlets, copy one from the `generated/cmdlets` folder. For script cmdlets, build the project using `build-module.ps1` and copy one of the scripts from the `..\exports` folder. After that, if you want to add new parameter sets, follow the guidelines in the `Details` section above. For implementing a new cmdlets, at minimum, please keep these parameters: +- Break +- DefaultProfile +- HttpPipelineAppend +- HttpPipelinePrepend +- Proxy +- ProxyCredential +- ProxyUseDefaultCredentials + +These provide functionality to our HTTP pipeline and other useful features. In script, you can forward these parameters using `$PSBoundParameters` to the other cmdlets you're calling within `Az.Blockchain`. For C#, follow the usage seen in the `ProcessRecordAsync` method. + +### Attributes +For processing the cmdlets, we've created some additional attributes: +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.DescriptionAttribute` + - Used in C# cmdlets to provide a high-level description of the cmdlet. This is propegated to reference documentation via [help comments](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comment_based_help) in the exported scripts. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.DoNotExportAttribute` + - Used in C# and script cmdlets to suppress creating an exported cmdlet at build-time. These cmdlets will *not be exposed* by `Az.Blockchain`. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.InternalExportAttribute` + - Used in C# cmdlets to route exported cmdlets to the `..\internal`, which are *not exposed* by `Az.Blockchain`. For more information, see [readme.md](..\internal/readme.md) in the `..\internal` folder. +- `Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.ProfileAttribute` + - Used in C# and script cmdlets to define which Azure profiles the cmdlet supports. This is only supported for Azure (`--azure`) modules. \ No newline at end of file diff --git a/src/Blockchain/examples/Get-AzBlockchainConsortium.md b/src/Blockchain/examples/Get-AzBlockchainConsortium.md new file mode 100644 index 000000000000..d7f6452c7c24 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainConsortium.md @@ -0,0 +1,8 @@ +### Example 1: Get Blockchain consortiums. +```powershell +PS C:\> Get-AzBlockchainConsortium -Location eastus + +``` + +This command lists the consortiums under a subscription for a specific location. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMember.md b/src/Blockchain/examples/Get-AzBlockchainMember.md new file mode 100644 index 000000000000..1394a454d5ec --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMember.md @@ -0,0 +1,50 @@ +### Example 1: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a subscription. + +### Example 2: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a resource group. + + +### Example 3: Get a blockchain member +```powershell +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +### Example 4: Get a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md b/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..e9fd70ada136 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMemberApiKey.md @@ -0,0 +1,12 @@ +### Example 1: List blockchain Api keys +```powershell +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command lists Api keys for a blockchain member. + diff --git a/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md b/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md new file mode 100644 index 000000000000..4ba3e6554bec --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainMemberConsortiumMember.md @@ -0,0 +1,11 @@ +### Example 1: Lists the consortium members for a blockchain member. +```powershell +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb +``` + +This command lists the consortium members for a blockchain member. + diff --git a/src/Blockchain/examples/Get-AzBlockchainSku.md b/src/Blockchain/examples/Get-AzBlockchainSku.md new file mode 100644 index 000000000000..697b29a8f170 --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainSku.md @@ -0,0 +1,7 @@ +### Example 1: List SKU for a subscription +```powershell +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + +``` + +This command lists SKU for a subscription. diff --git a/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..6efceb12588f --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainTransactionNode.md @@ -0,0 +1,34 @@ +### Example 1: List transaction nodes for a blockchain member +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command lists transaction nodes for a blockchain member. + +### Example 2: Get a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +### Example 3: Get a transaction node +```powershell +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + diff --git a/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..60bdc4a1ac5a --- /dev/null +++ b/src/Blockchain/examples/Get-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,11 @@ +### Example 1: List Api keys for a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command lists Api keys for a transaction node. diff --git a/src/Blockchain/examples/New-AzBlockchainMember.md b/src/Blockchain/examples/New-AzBlockchainMember.md new file mode 100644 index 000000000000..8670242f2deb --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainMember.md @@ -0,0 +1,13 @@ +### Example 1: Create a new blockchain member +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command creates a new blockchain member. + diff --git a/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md b/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..1bfb3d0b0582 --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainMemberApiKey.md @@ -0,0 +1,27 @@ +### Example 1: Regenerate Api keys for a blockchain member using name +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member using name, resource group. + +### Example 2: Regenerate Api keys for a blockchain member using idenity + +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member using identity. diff --git a/src/Blockchain/examples/New-AzBlockchainTransactionNode.md b/src/Blockchain/examples/New-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..e5f8428a3c1c --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainTransactionNode.md @@ -0,0 +1,12 @@ +### Example 1: Create a blockchain transaction node +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command creates a blockchain transaction node. + diff --git a/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..f874f2dee91d --- /dev/null +++ b/src/Blockchain/examples/New-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,28 @@ +### Example 1: Regenerate Api keys for a transaction node using name. +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node using name, resource group. + +### Example 2: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node using idenity. + + diff --git a/src/Blockchain/examples/Remove-AzBlockchainMember.md b/src/Blockchain/examples/Remove-AzBlockchainMember.md new file mode 100644 index 000000000000..6eb61c9a0e8c --- /dev/null +++ b/src/Blockchain/examples/Remove-AzBlockchainMember.md @@ -0,0 +1,17 @@ +### Example 1: Remove a blockchain member +```powershell +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +``` + +This command removes a blockchain member. + +### Example 2: Remove a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + +``` + +This command removes a blockchain member. + diff --git a/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..8e98f3b07c0d --- /dev/null +++ b/src/Blockchain/examples/Remove-AzBlockchainTransactionNode.md @@ -0,0 +1,16 @@ +### Example 1: Remove a transaction node +```powershell +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +``` + +This command removes a transaction node. + +### Example 2: Remove a transaction node +```powershell +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node +``` + +This command removes a transaction node. + diff --git a/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md b/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md new file mode 100644 index 000000000000..59b334286c9e --- /dev/null +++ b/src/Blockchain/examples/Test-AzBlockchainLocationNameAvailability.md @@ -0,0 +1,22 @@ +### Example 1: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +``` + +The command checks whether a resource name is available. + +### Example 2: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid +``` + +The command checks whether a resource name is available. + diff --git a/src/Blockchain/examples/Update-AzBlockchainMember.md b/src/Blockchain/examples/Update-AzBlockchainMember.md new file mode 100644 index 000000000000..809e71a5cf1c --- /dev/null +++ b/src/Blockchain/examples/Update-AzBlockchainMember.md @@ -0,0 +1,25 @@ +### Example 1: Update a blockchain member +```powershell +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +### Example 2: Update a blockchain member +```powershell +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + diff --git a/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md b/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..784d6f5079b3 --- /dev/null +++ b/src/Blockchain/examples/Update-AzBlockchainTransactionNode.md @@ -0,0 +1,25 @@ +### Example 1: Update a transcation node +```powershell +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +### Example 2: Update a transcation node +```powershell +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + diff --git a/src/Blockchain/export-surface.ps1 b/src/Blockchain/export-surface.ps1 new file mode 100644 index 000000000000..8c6a036c19df --- /dev/null +++ b/src/Blockchain/export-surface.ps1 @@ -0,0 +1,40 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$IncludeGeneralParameters, [switch]$UseExpandedFormat) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$dll = Join-Path $PSScriptRoot 'bin\Az.Blockchain.private.dll' +if(-not (Test-Path $dll)) { + Write-Error "Unable to find output assembly in '$binFolder'." +} +$null = Import-Module -Name $dll + +$moduleName = 'Az.Blockchain' +$exportsFolder = Join-Path $PSScriptRoot 'exports' +$resourcesFolder = Join-Path $PSScriptRoot 'resources' + +Export-CmdletSurface -ModuleName $moduleName -CmdletFolder $exportsFolder -OutputFolder $resourcesFolder -IncludeGeneralParameters $IncludeGeneralParameters.IsPresent -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "CmdletSurface file(s) created in '$resourcesFolder'" + +Export-ModelSurface -OutputFolder $resourcesFolder -UseExpandedFormat $UseExpandedFormat.IsPresent +Write-Host -ForegroundColor Green "ModelSurface file created in '$resourcesFolder'" + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 b/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 new file mode 100644 index 000000000000..0902208bc96b --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainConsortium.ps1 @@ -0,0 +1,133 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available consortiums for a subscription. +.Description +Lists the available consortiums for a subscription. +.Example +PS C:\> Get-AzBlockchainConsortium -Location eastus + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +#> +function Get-AzBlockchainConsortium { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainConsortium_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMember.ps1 b/src/Blockchain/exports/Get-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..82b280ab3f7a --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMember.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get details about a blockchain member. +.Description +Get details about a blockchain member. +.Example +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +#> +function Get-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainMember_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainMember_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainMember_List'; + List1 = 'Az.Blockchain.private\Get-AzBlockchainMember_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 b/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 new file mode 100644 index 000000000000..4c946ce20d97 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMemberApiKey.ps1 @@ -0,0 +1,144 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the API keys for a blockchain member. +.Description +Lists the API keys for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +#> +function Get-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 b/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 new file mode 100644 index 000000000000..7b74092afdce --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainMemberConsortiumMember.ps1 @@ -0,0 +1,143 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the consortium members for a blockchain member. +.Description +Lists the consortium members for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +#> +function Get-AzBlockchainMemberConsortiumMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberConsortiumMember_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainSku.ps1 b/src/Blockchain/exports/Get-AzBlockchainSku.ps1 new file mode 100644 index 000000000000..1bbdd98809c7 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainSku.ps1 @@ -0,0 +1,127 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the Skus of the resource type. +.Description +Lists the Skus of the resource type. +.Example +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +#> +function Get-AzBlockchainSku { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainSku_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..03774800eb87 --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,190 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of the transaction node. +.Description +Get the details of the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +#> +function Get-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 b/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 new file mode 100644 index 000000000000..88da6377bdef --- /dev/null +++ b/src/Blockchain/exports/Get-AzBlockchainTransactionNodeApiKey.ps1 @@ -0,0 +1,150 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List the API keys for the transaction node. +.Description +List the API keys for the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +#> +function Get-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNodeApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainMember.ps1 b/src/Blockchain/exports/New-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..a1d33a30219f --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainMember.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainMember'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 b/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 new file mode 100644 index 000000000000..6c8b1542b363 --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainMemberApiKey.ps1 @@ -0,0 +1,189 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for a blockchain member. +.Description +Regenerate the API keys for a blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +#> +function New-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..9b3e44f7262f --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainTransactionNode'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 b/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 new file mode 100644 index 000000000000..207b1c109153 --- /dev/null +++ b/src/Blockchain/exports/New-AzBlockchainTransactionNodeApiKey.ps1 @@ -0,0 +1,195 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for the blockchain member. +.Description +Regenerate the API keys for the blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +#> +function New-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 b/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..0d0a5f9c7d35 --- /dev/null +++ b/src/Blockchain/exports/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,2837 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available consortiums for a subscription. +.Description +Lists the available consortiums for a subscription. +.Example +PS C:\> Get-AzBlockchainConsortium -Location eastus + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +#> +function Get-AzBlockchainConsortium { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainConsortium_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the API keys for a blockchain member. +.Description +Lists the API keys for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +#> +function Get-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the consortium members for a blockchain member. +.Description +Lists the consortium members for a blockchain member. +.Example +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +#> +function Get-AzBlockchainMemberConsortiumMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainMemberConsortiumMember_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get details about a blockchain member. +.Description +Get details about a blockchain member. +.Example +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +#> +function Get-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='List1', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Parameter(ParameterSetName='List1')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainMember_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainMember_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainMember_List'; + List1 = 'Az.Blockchain.private\Get-AzBlockchainMember_List1'; + } + if (('Get', 'List', 'List1') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the Skus of the resource type. +.Description +Lists the Skus of the resource type. +.Example +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +#> +function Get-AzBlockchainSku { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainSku_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +List the API keys for the transaction node. +.Description +List the API keys for the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +#> +function Get-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNodeApiKey_List'; + } + if (('List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Get the details of the transaction node. +.Description +Get the details of the transaction node. +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +#> +function Get-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Get', Mandatory)] + [Parameter(ParameterSetName='List', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Get')] + [Parameter(ParameterSetName='List')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String[]] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='GetViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Get = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_Get'; + GetViaIdentity = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_GetViaIdentity'; + List = 'Az.Blockchain.private\Get-AzBlockchainTransactionNode_List'; + } + if (('Get', 'List') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for a blockchain member. +.Description +Regenerate the API keys for a blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +.Example +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +#> +function New-AzBlockchainMemberApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Regenerate the API keys for the blockchain member. +.Description +Regenerate the API keys for the blockchain member. +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +.Example +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +#> +function New-AzBlockchainTransactionNodeApiKey { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey])] +[CmdletBinding(DefaultParameterSetName='RegenerateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='RegenerateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='RegenerateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${TransactionNodeName}, + + [Parameter(ParameterSetName='RegenerateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key name. + ${KeyName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the API key value. + ${Value}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + RegenerateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateExpanded'; + RegenerateViaIdentityExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded'; + } + if (('RegenerateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a blockchain member. +.Description +Delete a blockchain member. +.Example +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +.Example +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +#> +function Remove-AzBlockchainMember { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainMember_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainMember_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete the transaction node. +.Description +Delete the transaction node. +.Example +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +.Example +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +#> +function Remove-AzBlockchainTransactionNode { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +To check whether a resource name is available. +.Description +To check whether a resource name is available. +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +#> +function Test-AzBlockchainLocationNameAvailability { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the name to check. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the type of the resource to check. + ${Type}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CheckExpanded = 'Az.Blockchain.private\Test-AzBlockchainLocationNameAvailability_CheckExpanded'; + } + if (('CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${Sku}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainMember'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.custom\New-AzBlockchainTransactionNode'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 b/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..47f06611c814 --- /dev/null +++ b/src/Blockchain/exports/Remove-AzBlockchainMember.ps1 @@ -0,0 +1,186 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete a blockchain member. +.Description +Delete a blockchain member. +.Example +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +.Example +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +#> +function Remove-AzBlockchainMember { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainMember_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainMember_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..2994c8f19642 --- /dev/null +++ b/src/Blockchain/exports/Remove-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Delete the transaction node. +.Description +Delete the transaction node. +.Example +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +.Example +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +System.Boolean +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +#> +function Remove-AzBlockchainTransactionNode { +[OutputType([System.Boolean])] +[CmdletBinding(DefaultParameterSetName='Delete', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='Delete', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='Delete')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='DeleteViaIdentity', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Returns true when the command succeeds + ${PassThru}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + Delete = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_Delete'; + DeleteViaIdentity = 'Az.Blockchain.private\Remove-AzBlockchainTransactionNode_DeleteViaIdentity'; + } + if (('Delete') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 b/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 new file mode 100644 index 000000000000..8f143cebf60f --- /dev/null +++ b/src/Blockchain/exports/Test-AzBlockchainLocationNameAvailability.ps1 @@ -0,0 +1,154 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +To check whether a resource name is available. +.Description +To check whether a resource name is available. +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +.Example +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +#> +function Test-AzBlockchainLocationNameAvailability { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability])] +[CmdletBinding(DefaultParameterSetName='CheckExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Location Name. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the name to check. + ${Name}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the type of the resource to check. + ${Type}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CheckExpanded = 'Az.Blockchain.private\Test-AzBlockchainLocationNameAvailability_CheckExpanded'; + } + if (('CheckExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Update-AzBlockchainMember.ps1 b/src/Blockchain/exports/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..c3e00c474cdb --- /dev/null +++ b/src/Blockchain/exports/Update-AzBlockchainMember.ps1 @@ -0,0 +1,207 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainMember'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..4c6069f5a942 --- /dev/null +++ b/src/Blockchain/exports/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Security.SecureString] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + UpdateViaIdentityExpanded = 'Az.Blockchain.custom\Update-AzBlockchainTransactionNode'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/exports/readme.md b/src/Blockchain/exports/readme.md new file mode 100644 index 000000000000..7f1c2e1b9a45 --- /dev/null +++ b/src/Blockchain/exports/readme.md @@ -0,0 +1,20 @@ +# Exports +This directory contains the cmdlets *exported by* `Az.Blockchain`. No other cmdlets in this repository are directly exported. What that means is the `Az.Blockchain` module will run [Export-ModuleMember](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/export-modulemember) on the cmldets in this directory. The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The cmdlets generated here are created every time you run `build-module.ps1`. These cmdlets are a merge of all (excluding `InternalExport`) cmdlets from the private binary (`..\bin\Az.Blockchain.private.dll`) and from the `..\custom\Az.Blockchain.custom.psm1` module. Cmdlets that are *not merged* from those directories are decorated with the `InternalExport` attribute. This happens when you set the cmdlet to **hide** from configuration. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) or the [readme.md](..\internal/readme.md) in the `..\internal` folder. + +## Purpose +We generate script cmdlets out of the binary cmdlets and custom cmdlets. The format of script cmdlets are simplistic; thus, easier to generate at build time. Generating the cmdlets is required as to allow merging of generated binary, hand-written binary, and hand-written custom cmdlets. For Azure cmdlets, having script cmdlets simplifies the mechanism for exporting Azure profiles. + +## Structure +The cmdlets generated here will flat in the directory (no sub-folders) as long as there are no Azure profiles specified for any cmdlets. Azure profiles (the `Profiles` attribute) is only applied when generating with the `--azure` attribute (or `azure: true` in the configuration). When Azure profiles are applied, the folder structure has a folder per profile. Each profile folder has only those cmdlets that apply to that profile. + +## Usage +When `./Az.Blockchain.psm1` is loaded, it dynamically exports cmdlets here based on the folder structure and on the selected profile. If there are no sub-folders, it exports all cmdlets at the root of this folder. If there are sub-folders, it checks to see the selected profile. If no profile is selected, it exports the cmdlets in the last sub-folder (alphabetically). If a profile is selected, it exports the cmdlets in the sub-folder that matches the profile name. If there is no sub-folder that matches the profile name, it exports no cmdlets and writes a warning message. \ No newline at end of file diff --git a/src/Blockchain/generate-help.ps1 b/src/Blockchain/generate-help.ps1 new file mode 100644 index 000000000000..bee64e686378 --- /dev/null +++ b/src/Blockchain/generate-help.ps1 @@ -0,0 +1,73 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated) +$ErrorActionPreference = 'Stop' + +$pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$exportsFolder = Join-Path $PSScriptRoot 'exports' +if(-not (Test-Path $exportsFolder)) { + Write-Error "Exports folder '$exportsFolder' was not found." +} + +$directories = Get-ChildItem -Directory -Path $exportsFolder +$hasProfiles = ($directories | Measure-Object).Count -gt 0 +if(-not $hasProfiles) { + $directories = Get-Item -Path $exportsFolder +} + +$docsFolder = Join-Path $PSScriptRoot 'docs' +if(Test-Path $docsFolder) { + $null = Get-ChildItem -Path $docsFolder -Recurse -Exclude 'readme.md' | Remove-Item -Recurse -ErrorAction SilentlyContinue +} +$null = New-Item -ItemType Directory -Force -Path $docsFolder -ErrorAction SilentlyContinue +$examplesFolder = Join-Path $PSScriptRoot 'examples' + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +# Load DLL to use build-time cmdlets +Import-Module -Name $modulePath +Import-Module -Name (Join-Path $PSScriptRoot './bin/Az.Blockchain.private.dll') +$instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance +# Module info is shared per profile +$moduleInfo = Get-Module -Name $moduleName + +foreach($directory in $directories) +{ + if($hasProfiles) { + Select-AzProfile -Name $directory.Name + } + # Reload module per profile + Import-Module -Name $modulePath -Force + + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $directory.FullName + $cmdletHelpInfo = $cmdletNames | ForEach-Object { Get-Help -Name $_ -Full } + $cmdletFunctionInfo = Get-ScriptCmdlet -ScriptFolder $directory.FullName -AsFunctionInfo + + $docsPath = Join-Path $docsFolder $directory.Name + $null = New-Item -ItemType Directory -Force -Path $docsPath -ErrorAction SilentlyContinue + $examplesPath = Join-Path $examplesFolder $directory.Name + + Export-HelpMarkdown -ModuleInfo $moduleInfo -FunctionInfo $cmdletFunctionInfo -HelpInfo $cmdletHelpInfo -DocsFolder $docsPath -ExamplesFolder $examplesPath + Write-Host -ForegroundColor Green "Created documentation in '$docsPath'" +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/generate-info.json b/src/Blockchain/generate-info.json new file mode 100644 index 000000000000..956d0936d9e8 --- /dev/null +++ b/src/Blockchain/generate-info.json @@ -0,0 +1,8 @@ +{ + "autorest_powershell": "2.1.384", + "autorest": "3.0.6187", + "autorest_core": "3.0.6282", + "node": "v10.16.0", + "swagger_commit": "deb7e9c6f78ea7be17bc83f0fddaaba6c5699b29", + "autorest_remodeler": "2.1.27" +} diff --git a/src/Blockchain/generated/Module.cs b/src/Blockchain/generated/Module.cs new file mode 100644 index 000000000000..a815952f6166 --- /dev/null +++ b/src/Blockchain/generated/Module.cs @@ -0,0 +1,158 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + using SendAsyncStepDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + using PipelineChangeDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>; + using GetParameterDelegate = global::System.Func; + using ModuleLoadPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>, global::System.Action, global::System.Threading.Tasks.Task>, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>>>; + using ArgumentCompleterDelegate = global::System.Func; + using SignalDelegate = global::System.Func, global::System.Threading.Tasks.Task>; + using EventListenerDelegate = global::System.Func, global::System.Func, global::System.Threading.Tasks.Task>, global::System.Management.Automation.InvocationInfo, string, string, string, global::System.Exception, global::System.Threading.Tasks.Task>; + using NextDelegate = global::System.Func, global::System.Threading.Tasks.Task>, global::System.Threading.Tasks.Task>; + + /// A class that contains the module-common code and data. + public partial class Module + { + /// The currently selected profile. + public string Profile = global::System.String.Empty; + + public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + + /// the ISendAsync pipeline instance + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline _pipeline; + + /// the ISendAsync pipeline instance (when proxy is enabled) + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline _pipelineWithProxy; + + public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); + + /// Gets completion data for azure specific fields + public ArgumentCompleterDelegate ArgumentCompleter { get; set; } + + /// The instance of the Client API + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain ClientAPI { get; set; } + + /// A delegate that gets called for each signalled event + public EventListenerDelegate EventListener { get; set; } + + /// The delegate to call to get parameter data from a common module. + public GetParameterDelegate GetParameterValue { get; set; } + + /// Backing field for property. + private static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module _instance; + + /// the singleton of this module class + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module()); + + /// The Name of this module + public string Name => @"Az.Blockchain"; + + /// The delegate to call when this module is loaded (supporting a commmon module). + public ModuleLoadPipelineDelegate OnModuleLoad { get; set; } + + /// The delegate to call before each new request (supporting a commmon module). + public NewRequestPipelineDelegate OnNewRequest { get; set; } + + /// The name of the currently selected Azure profile + public global::System.String ProfileName { get; set; } + + /// The ResourceID for this module (azure arm). + public string ResourceId => @"Az.Blockchain"; + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void AfterCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline); + + /// The from the cmdlet + /// The HttpPipeline for the request + + partial void BeforeCreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline); + + partial void CustomInit(); + + /// Creates an instance of the HttpPipeline for each call. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the cmdlet's parameterset name. + /// An instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline for the remote call. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline CreatePipeline(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string processRecordId, string parameterSetName = null) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline pipeline = null; + BeforeCreatePipeline(invocationInfo, ref pipeline); + pipeline = (pipeline ?? (_handler.UseProxy ? _pipelineWithProxy : _pipeline)).Clone(); + AfterCreatePipeline(invocationInfo, ref pipeline); + pipeline.Append(new Runtime.CmdInfoHandler(processRecordId, invocationInfo, parameterSetName).SendAsync); + OnNewRequest?.Invoke( invocationInfo, correlationId,processRecordId, (step)=> { pipeline.Prepend(step); } , (step)=> { pipeline.Append(step); } ); + return pipeline; + } + + /// Gets parameters from a common module. + /// The from the cmdlet + /// the cmdlet's correlation id. + /// The name of the parameter to get the value for. + /// + /// The parameter value from the common module. (Note: this should be type converted on the way back) + /// + public object GetParameter(global::System.Management.Automation.InvocationInfo invocationInfo, string correlationId, string parameterName) => GetParameterValue?.Invoke( ResourceId, Name, invocationInfo, correlationId,parameterName ); + + /// Initialization steps performed after the module is loaded. + public void Init() + { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + } + + /// Creates the module instance. + private Module() + { + /// constructor + ClientAPI = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain(); + _handler.Proxy = _webProxy; + _pipeline = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient())); + _pipelineWithProxy = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpClientFactory(new global::System.Net.Http.HttpClient(_handler))); + } + + /// The HTTP Proxy to use. + /// The HTTP Proxy Credentials + /// True if the proxy should use default credentials + public void SetProxyConfiguration(global::System.Uri proxy, global::System.Management.Automation.PSCredential proxyCredential, bool proxyUseDefaultCredentials) + { + // set the proxy configuration + _webProxy.Address = proxy; + _webProxy.BypassProxyOnLocal = false; + _webProxy.Credentials = proxyCredential ?.GetNetworkCredential(); + _webProxy.UseDefaultCredentials = proxyUseDefaultCredentials; + _handler.UseProxy = proxy != null; + } + + /// Called to dispatch events to the common module listener + /// The ID of the event + /// The cancellation token for the event + /// A delegate to get the detailed event data + /// The callback for the event dispatcher + /// The from the cmdlet + /// the cmdlet's parameterset name. + /// the cmdlet's correlation id. + /// the cmdlet's process record correlation id. + /// the exception that is being thrown (if available) + /// + /// A that will be complete when handling of the event is completed. + /// + public async global::System.Threading.Tasks.Task Signal(string id, global::System.Threading.CancellationToken token, global::System.Func getEventData, SignalDelegate signal, global::System.Management.Automation.InvocationInfo invocationInfo, string parameterSetName, string correlationId, string processRecordId, global::System.Exception exception) + { + using( NoSynchronizationContext ) + { + await EventListener?.Invoke(id,token,getEventData, signal, invocationInfo, parameterSetName, correlationId,processRecordId,exception); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Blockchain.cs b/src/Blockchain/generated/api/Blockchain.cs new file mode 100644 index 000000000000..573c37a508d5 --- /dev/null +++ b/src/Blockchain/generated/api/Blockchain.cs @@ -0,0 +1,3810 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Low-level API implementation for the Blockchain service. + /// + public partial class Blockchain + { + + /// Get Async operation result. + /// Location name. + /// Operation Id. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet(string location, string operationId, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/blockchainMemberOperationResults/" + + global::System.Uri.EscapeDataString(operationId) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMemberOperationResultsGet_Call(request,onOk,onNoContent,eventListener,sender); + } + } + + /// Get Async operation result. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)/blockchainMemberOperationResults/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/blockchainMemberOperationResults/{operationId}'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var operationId = _match.Groups["operationId"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/blockchainMemberOperationResults/" + + operationId + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMemberOperationResultsGet_Call(request,onOk,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.OperationResult.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Location name. + /// Operation Id. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMemberOperationResultsGet_Validate(string location, string operationId, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(operationId),operationId); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Create a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create a blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersCreate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Create a blockchain member. + /// + /// Payload to create a blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create a blockchain member. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersCreate_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete a blockchain member. + /// Blockchain member name + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersDelete(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Delete a blockchain member. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersDelete_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Get details about a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersGet(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get details about a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersGet_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the blockchain members for a resource group. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersList(string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the blockchain members for a subscription. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListAll(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListAll_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the blockchain members for a subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListAllViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListAll_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListAll_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListAll_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists the API keys for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the API keys for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListApiKeysViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListApiKeys_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the consortium members for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/consortiumMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListConsortiumMembers_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the consortium members for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembersViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/consortiumMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/consortiumMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersListConsortiumMembers_Call(request,onOk,eventListener,sender); + } + } + + /// + /// Actual wire call for method. + /// + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but + /// you will get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersListConsortiumMembers_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the blockchain members for a resource group. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersList_Validate(string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Regenerate the API keys for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerate + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Regenerate the API keys for a blockchain member. + /// + /// api key to be regenerate + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeysViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerate + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersRegenerateApiKeys_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Update a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to update the blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersUpdate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Update a blockchain member. + /// + /// Payload to update the blockchain member. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task BlockchainMembersUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.BlockchainMembersUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to update the blockchain member. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task BlockchainMembersUpdate_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// To check whether a resource name is available. + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// Name availability request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsCheckNameAvailability(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsCheckNameAvailability_Call(request,onOk,eventListener,sender); + } + } + + /// To check whether a resource name is available. + /// + /// Name availability request payload. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsCheckNameAvailabilityViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/checkNameAvailability'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/checkNameAvailability" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsCheckNameAvailability_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsCheckNameAvailability_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailability.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// Name availability request payload. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsCheckNameAvailability_Validate(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Lists the available consortiums for a subscription. + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsListConsortiums(string location, string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/locations/" + + global::System.Uri.EscapeDataString(location) + + "/listConsortiums" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsListConsortiums_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available consortiums for a subscription. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task LocationsListConsortiumsViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/locations/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/listConsortiums'"); + } + + // replace URI parameters with values from identity + var location = _match.Groups["location"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/locations/" + + location + + "/listConsortiums" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.LocationsListConsortiums_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsListConsortiums_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get + /// validation events back. + /// + /// Location Name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task LocationsListConsortiums_Validate(string location, string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(location),location); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsList(global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.Blockchain/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task OperationsListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/providers/Microsoft.Blockchain/operations$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/providers/Microsoft.Blockchain/operations'"); + } + + // replace URI parameters with values from identity + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/providers/Microsoft.Blockchain/operations" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.OperationsList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task OperationsList_Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + + } + } + + /// Lists the Skus of the resource type. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SkusList(string subscriptionId, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/providers/Microsoft.Blockchain/skus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SkusList_Call(request,onOk,eventListener,sender); + } + } + + /// Lists the Skus of the resource type. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task SkusListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/providers/Microsoft.Blockchain/skus$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus'"); + } + + // replace URI parameters with values from identity + var subscriptionId = _match.Groups["subscriptionId"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/providers/Microsoft.Blockchain/skus" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.SkusList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SkusList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation events + /// back. + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task SkusList_Validate(string subscriptionId, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + } + } + + /// Create or update the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesCreate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Create or update the transaction node. + /// + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesCreateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Put, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesCreate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesCreate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_originalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_originalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesCreate_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Delete the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesDelete(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Delete the transaction node. + /// + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesDeleteViaIdentity(global::System.String viaIdentity, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Delete, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesDelete_Call(request,onNoContent,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 204 (NoContent). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesDelete_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func onNoContent, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + // this operation supports x-ms-long-running-operation + var _originalUri = request.RequestUri.AbsoluteUri; + // declared final-state-via: default + var _finalUri = _response.GetFirstHeader(@"Location"); + var asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = _response.GetFirstHeader(@"Location"); + while (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + + // get the delay before polling. (default to 30 seconds if not present) + int delay = (int)(_response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling, $"Delaying {delay} seconds before polling.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // start the delay timer (we'll await later...) + var waiting = global::System.Threading.Tasks.Task.Delay(delay * 1000, eventListener.Token ); + + // while we wait, let's grab the headers and get ready to poll. + if (!System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Azure-AsyncOperation"))) { + asyncOperation = _response.GetFirstHeader(@"Azure-AsyncOperation"); + } + if (!global::System.String.IsNullOrEmpty(_response.GetFirstHeader(@"Location"))) { + location = _response.GetFirstHeader(@"Location"); + } + var _uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? _originalUri : location : asyncOperation; + request = request.CloneAndDispose(new global::System.Uri(_uri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // and let's look at the current response body and see if we have some information we can give back to the listener + var content = await _response.Content.ReadAsStringAsync(); + await waiting; + + // check for cancellation + if( eventListener.Token.IsCancellationRequested ) { return; } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polling {_uri}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + // drop the old response + _response?.Dispose(); + + // make the polling call + _response = await sender.SendAsync(request, eventListener); + + // if we got back an OK, take a peek inside and see if it's done + if( _response.StatusCode == global::System.Net.HttpStatusCode.OK) + { + try { + if( Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(await _response.Content.ReadAsStringAsync()) is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + var state = json.Property("properties")?.PropertyT("provisioningState") ?? json.PropertyT("status"); + if( state is null ) + { + // the body doesn't contain any information that has the state of the LRO + // we're going to just get out, and let the consumer have the result + break; + } + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Polling, $"Polled {_uri} provisioning state {state}.", _response); if( eventListener.Token.IsCancellationRequested ) { return; } + + switch( state?.ToString()?.ToLower() ) + { + case "succeeded": + case "failed": + case "canceled": + // we're done polling. + break; + + default: + // need to keep polling! + _response.StatusCode = global::System.Net.HttpStatusCode.Created; + continue; + } + } + } catch { + // if we run into a problem peeking into the result, + // we really don't want to do anything special. + } + } + + // check for terminal status code + if (_response.StatusCode == global::System.Net.HttpStatusCode.Created || _response.StatusCode == global::System.Net.HttpStatusCode.Accepted ) + { + continue; + } + // we are done polling, do a request on final target? + if (!string.IsNullOrWhiteSpace(_finalUri)) + { + // create a new request with the final uri + request = request.CloneAndDispose(new global::System.Uri(_finalUri), Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get); + + // drop the old response + _response?.Dispose(); + + // make the final call + _response = await sender.SendAsync(request, eventListener); + break; + } + } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.NoContent: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onNoContent(_response); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesDelete_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Get the details of the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesGet(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Get the details of the transaction node. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesGetViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesGet_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesGet_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesGet_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the transaction nodes for a blockchain member. + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesList(string blockchainMemberName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesList_Call(request,onOk,eventListener,sender); + } + } + + /// List the API keys for the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListApiKeys(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// List the API keys for the transaction node. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListApiKeysViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "/listApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesListApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesListApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will + /// get validation events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesListApiKeys_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Lists the transaction nodes for a blockchain member. + /// + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesListViaIdentity(global::System.String viaIdentity, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesList_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesList_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesList_Validate(string blockchainMemberName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + } + } + + /// Regenerate the API keys for the blockchain member. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerated + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Regenerate the API keys for the blockchain member. + /// + /// api key to be regenerated + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeysViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "/regenerateApiKeys" + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Post, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesRegenerateApiKeys_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyCollection.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you + /// will get validation events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// api key to be regenerated + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesRegenerateApiKeys_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + + /// Update the transaction node. + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesUpdate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + global::System.Uri.EscapeDataString(subscriptionId) + + "/resourceGroups/" + + global::System.Uri.EscapeDataString(resourceGroupName) + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + global::System.Uri.EscapeDataString(blockchainMemberName) + + "/transactionNodes/" + + global::System.Uri.EscapeDataString(transactionNodeName) + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Update the transaction node. + /// + /// Payload to create the transaction node. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + public async global::System.Threading.Tasks.Task TransactionNodesUpdateViaIdentity(global::System.String viaIdentity, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + var apiVersion = @"2018-06-01-preview"; + // Constant Parameters + using( NoSynchronizationContext ) + { + // verify that Identity format is an exact match for uri + + var _match = new global::System.Text.RegularExpressions.Regex("^/subscriptions/(?[^/]+)/resourceGroups/(?[^/]+)/providers/Microsoft.Blockchain/blockchainMembers/(?[^/]+)/transactionNodes/(?[^/]+)$").Match(viaIdentity); + if (!_match.Success) + { + throw new global::System.Exception("Invalid identity for URI '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}'"); + } + + // replace URI parameters with values from identity + var blockchainMemberName = _match.Groups["blockchainMemberName"].Value; + var transactionNodeName = _match.Groups["transactionNodeName"].Value; + var subscriptionId = _match.Groups["subscriptionId"].Value; + var resourceGroupName = _match.Groups["resourceGroupName"].Value; + // construct URL + var _url = new global::System.Uri(global::System.Text.RegularExpressions.Regex.Replace( + "https://management.azure.com/subscriptions/" + + subscriptionId + + "/resourceGroups/" + + resourceGroupName + + "/providers/Microsoft.Blockchain/blockchainMembers/" + + blockchainMemberName + + "/transactionNodes/" + + transactionNodeName + + "?" + + "api-version=" + global::System.Uri.EscapeDataString(apiVersion) + ,"\\?&*$|&*$|(\\?)&+|(&)&+","$1$2")); + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.URLCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + // generate request object + var request = new global::System.Net.Http.HttpRequestMessage(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Patch, _url); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.RequestCreated, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.HeaderParametersAdded, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // set body content + request.Content = new global::System.Net.Http.StringContent(null != body ? body.ToJson(null).ToString() : @"{}", global::System.Text.Encoding.UTF8); + request.Content.Headers.ContentType = global::System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json"); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BodyContentSet, _url); if( eventListener.Token.IsCancellationRequested ) { return; } + // make the call + await this.TransactionNodesUpdate_Call(request,onOk,eventListener,sender); + } + } + + /// Actual wire call for method. + /// the prepared HttpRequestMessage to send. + /// a delegate that is called when the remote service returns 200 (OK). + /// an instance that will receive events. + /// an instance of an Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync pipeline to use to make the request. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesUpdate_Call(global::System.Net.Http.HttpRequestMessage request, global::System.Func, global::System.Threading.Tasks.Task> onOk, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.ISendAsync sender) + { + using( NoSynchronizationContext ) + { + global::System.Net.Http.HttpResponseMessage _response = null; + try + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeCall, request); if( eventListener.Token.IsCancellationRequested ) { return; } + _response = await sender.SendAsync(request, eventListener); + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ResponseCreated, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + var _contentType = _response.Content.Headers.ContentType?.MediaType; + + switch ( _response.StatusCode ) + { + case global::System.Net.HttpStatusCode.OK: + { + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.BeforeResponseDispatch, _response); if( eventListener.Token.IsCancellationRequested ) { return; } + await onOk(_response,_response.Content.ReadAsStringAsync().ContinueWith( body => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(body.Result)) )); + break; + } + default: + { + throw new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException(_response); + } + } + } + finally + { + // finally statements + await eventListener.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Finally, request, _response); + _response?.Dispose(); + request?.Dispose(); + } + } + } + + /// + /// Validation method for method. Call this like the actual call, but you will get validation + /// events back. + /// + /// Blockchain member name. + /// Transaction node name. + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + /// subscription ID is part of the URI for every service call. + /// The name of the resource group that contains the resource. You can obtain this value from + /// the Azure Resource Manager API or the portal. + /// Payload to create the transaction node. + /// an instance that will receive events. + /// + /// A that will be complete when handling of the response is completed. + /// + internal async global::System.Threading.Tasks.Task TransactionNodesUpdate_Validate(string blockchainMemberName, string transactionNodeName, string subscriptionId, string resourceGroupName, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate body, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + using( NoSynchronizationContext ) + { + await eventListener.AssertNotNull(nameof(blockchainMemberName),blockchainMemberName); + await eventListener.AssertNotNull(nameof(transactionNodeName),transactionNodeName); + await eventListener.AssertNotNull(nameof(subscriptionId),subscriptionId); + await eventListener.AssertNotNull(nameof(resourceGroupName),resourceGroupName); + await eventListener.AssertNotNull(nameof(body), body); + await eventListener.AssertObjectIsValid(nameof(body), body); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs new file mode 100644 index 000000000000..5ea5b01e4aac --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ApiKeyTypeConverter))] + public partial class ApiKey + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiKey(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName = (string) content.GetValueForProperty("KeyName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value = (string) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiKey(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName = (string) content.GetValueForProperty("KeyName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).KeyName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value = (string) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal)this).Value, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiKey(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiKey(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// API key payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ApiKeyTypeConverter))] + public partial interface IApiKey + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs new file mode 100644 index 000000000000..29b7a42a6408 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiKeyTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiKey.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiKey.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiKey.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs new file mode 100644 index 000000000000..ca9a35d700bf --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + public partial class ApiKey : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyInternal + { + + /// Backing field for property. + private string _keyName; + + /// Gets or sets the API key name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string KeyName { get => this._keyName; set => this._keyName = value; } + + /// Backing field for property. + private string _value; + + /// Gets or sets the API key value. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ApiKey() + { + + } + } + /// API key payload which is exposed in the request/response of the resource provider. + public partial interface IApiKey : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the API key name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + string KeyName { get; set; } + /// Gets or sets the API key value. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + string Value { get; set; } + + } + /// API key payload which is exposed in the request/response of the resource provider. + internal partial interface IApiKeyInternal + + { + /// Gets or sets the API key name. + string KeyName { get; set; } + /// Gets or sets the API key value. + string Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs new file mode 100644 index 000000000000..d78f156bcffd --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKey.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + public partial class ApiKey + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ApiKey(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_keyName = If( json?.PropertyT("keyName"), out var __jsonKeyName) ? (string)__jsonKeyName : (string)KeyName;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? (string)__jsonValue : (string)Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ApiKey(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._keyName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._keyName.ToString()) : null, "keyName" ,container.Add ); + AddIf( null != (((object)this._value)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._value.ToString()) : null, "value" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs new file mode 100644 index 000000000000..6b2d9987baf0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ApiKeyCollectionTypeConverter))] + public partial class ApiKeyCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ApiKeyCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[]) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ApiKeyCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[]) content.GetValueForProperty("Key",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal)this).Key, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKeyTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ApiKeyCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ApiKeyCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ApiKeyCollectionTypeConverter))] + public partial interface IApiKeyCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs new file mode 100644 index 000000000000..f7db25616147 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ApiKeyCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ApiKeyCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ApiKeyCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ApiKeyCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs new file mode 100644 index 000000000000..4f2aa8047e61 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.cs @@ -0,0 +1,48 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + public partial class ApiKeyCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] _key; + + /// Gets or sets the collection of API key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get => this._key; set => this._key = value; } + + /// Creates an new instance. + public ApiKeyCollection() + { + + } + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + public partial interface IApiKeyCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of API key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of API key.", + SerializedName = @"keys", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get; set; } + + } + /// Collection of the API key payload which is exposed in the response of the resource provider. + internal partial interface IApiKeyCollectionInternal + + { + /// Gets or sets the collection of API key. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey[] Key { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs new file mode 100644 index 000000000000..54897e1f4927 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ApiKeyCollection.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the API key payload which is exposed in the response of the resource provider. + /// + public partial class ApiKeyCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ApiKeyCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_key = If( json?.PropertyT("keys"), out var __jsonKeys) ? If( __jsonKeys as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey.FromJson(__u) )) ))() : null : Key;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKeyCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ApiKeyCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._key) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._key ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("keys",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs new file mode 100644 index 000000000000..80567e76a101 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.PowerShell.cs @@ -0,0 +1,179 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberTypeConverter))] + public partial class BlockchainMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier = (string) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Sku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier = (string) content.GetValueForProperty("SkuTier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuTier, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName = (string) content.GetValueForProperty("SkuName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).SkuName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberTypeConverter))] + public partial interface IBlockchainMember + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs new file mode 100644 index 000000000000..d0807d213157 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs new file mode 100644 index 000000000000..0e0c0415d863 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.cs @@ -0,0 +1,352 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource(); + + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Consortium { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Consortium; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Consortium = value; } + + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress; } + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountPassword = value; } + + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumMemberDisplayName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumMemberDisplayName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumMemberDisplayName = value; } + + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumRole { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumRole; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumRole = value; } + + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns; } + + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).FirewallRule = value; } + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id; } + + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Location { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Location; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Location = value; } + + /// Internal Acessors for ConsortiumManagementAccountAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ConsortiumManagementAccountAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ConsortiumManagementAccountAddress = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Dns = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey = value; } + + /// Internal Acessors for RootContractAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.RootContractAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress = value; } + + /// Internal Acessors for Sku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku()); set { {_sku = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName = value; } + + /// Internal Acessors for ValidatorNodesSku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberInternal.ValidatorNodesSku { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodesSku; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodesSku = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Name; } + + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties _property; + + /// Gets or sets the blockchain member properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties()); set => this._property = value; } + + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Protocol; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).Protocol = value; } + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ProvisioningState; } + + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).PublicKey; } + + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string RootContractAddress { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).RootContractAddress; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku _sku; + + /// Gets or sets the blockchain member Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Sku { get => (this._sku = this._sku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku()); set => this._sku = value; } + + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string SkuName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Name = value; } + + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string SkuTier { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Tier; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)Sku).Tier = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Tag; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)__trackedResource).Tag = value; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__trackedResource).Type; } + + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).UserName; } + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public int? ValidatorNodeSkuCapacity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodeSkuCapacity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)Property).ValidatorNodeSkuCapacity = value; } + + /// Creates an new instance. + public BlockchainMember() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__trackedResource), __trackedResource); + await eventListener.AssertObjectIsValid(nameof(__trackedResource), __trackedResource); + } + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource + { + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + string Consortium { get; set; } + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the managed consortium management account address.", + SerializedName = @"consortiumManagementAccountAddress", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountAddress { get; } + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the dns endpoint of the blockchain member.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; } + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the public key of the blockchain member (default transaction node).", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the Ethereum root contract address of the blockchain.", + SerializedName = @"rootContractAddress", + PossibleTypes = new [] { typeof(string) })] + string RootContractAddress { get; } + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string SkuName { get; set; } + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string SkuTier { get; set; } + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the auth user name of the blockchain member.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? ValidatorNodeSkuCapacity { get; set; } + + } + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal + { + /// Gets or sets the consortium for the blockchain member. + string Consortium { get; set; } + /// Gets the managed consortium management account address. + string ConsortiumManagementAccountAddress { get; set; } + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + string Dns { get; set; } + /// Gets or sets firewall rules + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + string Password { get; set; } + /// Gets or sets the blockchain member properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties Property { get; set; } + /// Gets or sets the blockchain protocol. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; set; } + /// Gets the public key of the blockchain member (default transaction node). + string PublicKey { get; set; } + /// Gets the Ethereum root contract address of the blockchain. + string RootContractAddress { get; set; } + /// Gets or sets the blockchain member Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku Sku { get; set; } + /// Gets or sets Sku name + string SkuName { get; set; } + /// Gets or sets Sku tier + string SkuTier { get; set; } + /// Gets the auth user name of the blockchain member. + string UserName { get; set; } + /// Gets or sets the nodes capacity. + int? ValidatorNodeSkuCapacity { get; set; } + /// Gets or sets the blockchain validator nodes Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs new file mode 100644 index 000000000000..efe0dd3588ee --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMember.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMember(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __trackedResource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberProperties.FromJson(__jsonProperties) : Property;} + {_sku = If( json?.PropertyT("sku"), out var __jsonSku) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Sku.FromJson(__jsonSku) : Sku;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMember(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __trackedResource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._sku ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._sku.ToJson(null,serializationMode) : null, "sku" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs new file mode 100644 index 000000000000..ee3acdd0527e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberCollectionTypeConverter))] + public partial class BlockchainMemberCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberCollectionTypeConverter))] + public partial interface IBlockchainMemberCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs new file mode 100644 index 000000000000..170c57ecd41a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs new file mode 100644 index 000000000000..5c465263160a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] _value; + + /// Gets or sets the collection of blockchain members. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public BlockchainMemberCollection() + { + + } + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of blockchain members. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of blockchain members.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get; set; } + + } + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of blockchain members. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs new file mode 100644 index 000000000000..0e89159f53b0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberCollection.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of the blockchain member payload which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs new file mode 100644 index 000000000000..d7c4fd173a25 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberNodesSkuTypeConverter))] + public partial class BlockchainMemberNodesSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberNodesSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity = (int?) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberNodesSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity = (int?) content.GetValueForProperty("Capacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)this).Capacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberNodesSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberNodesSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberNodesSkuTypeConverter))] + public partial interface IBlockchainMemberNodesSku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs new file mode 100644 index 000000000000..e71c0231dd6a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberNodesSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberNodesSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberNodesSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberNodesSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs new file mode 100644 index 000000000000..cb0c7e1c8e5b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial class BlockchainMemberNodesSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal + { + + /// Backing field for property. + private int? _capacity; + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public int? Capacity { get => this._capacity; set => this._capacity = value; } + + /// Creates an new instance. + public BlockchainMemberNodesSku() + { + + } + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial interface IBlockchainMemberNodesSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? Capacity { get; set; } + + } + /// Payload of the blockchain member nodes Sku for a blockchain member. + internal partial interface IBlockchainMemberNodesSkuInternal + + { + /// Gets or sets the nodes capacity. + int? Capacity { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs new file mode 100644 index 000000000000..fee11fd68110 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberNodesSku.json.cs @@ -0,0 +1,101 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member nodes Sku for a blockchain member. + public partial class BlockchainMemberNodesSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberNodesSku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_capacity = If( json?.PropertyT("capacity"), out var __jsonCapacity) ? (int?)__jsonCapacity : Capacity;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberNodesSku(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._capacity ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNumber((int)this._capacity) : null, "capacity" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs new file mode 100644 index 000000000000..2beeca91e2b5 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.PowerShell.cs @@ -0,0 +1,161 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesTypeConverter))] + public partial class BlockchainMemberProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku) content.GetValueForProperty("ValidatorNodesSku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodesSku, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSkuTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium = (string) content.GetValueForProperty("Consortium",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Consortium, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress = (string) content.GetValueForProperty("ConsortiumManagementAccountAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName = (string) content.GetValueForProperty("ConsortiumMemberDisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumMemberDisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole = (string) content.GetValueForProperty("ConsortiumRole",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ConsortiumRole, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress = (string) content.GetValueForProperty("RootContractAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).RootContractAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).UserName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity = (int?) content.GetValueForProperty("ValidatorNodeSkuCapacity",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal)this).ValidatorNodeSkuCapacity, (__y)=> (int) global::System.Convert.ChangeType(__y, typeof(int))); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesTypeConverter))] + public partial interface IBlockchainMemberProperties + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs new file mode 100644 index 000000000000..5f0d6e9dee58 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberPropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs new file mode 100644 index 000000000000..613f9634db17 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.cs @@ -0,0 +1,294 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal + { + + /// Backing field for property. + private string _consortium; + + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Consortium { get => this._consortium; set => this._consortium = value; } + + /// Backing field for property. + private string _consortiumManagementAccountAddress; + + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountAddress { get => this._consortiumManagementAccountAddress; } + + /// Backing field for property. + private string _consortiumManagementAccountPassword; + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountPassword { get => this._consortiumManagementAccountPassword; set => this._consortiumManagementAccountPassword = value; } + + /// Backing field for property. + private string _consortiumMemberDisplayName; + + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumMemberDisplayName { get => this._consortiumMemberDisplayName; set => this._consortiumMemberDisplayName = value; } + + /// Backing field for property. + private string _consortiumRole; + + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumRole { get => this._consortiumRole; set => this._consortiumRole = value; } + + /// Backing field for property. + private string _dns; + + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Dns { get => this._dns; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Internal Acessors for ConsortiumManagementAccountAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ConsortiumManagementAccountAddress { get => this._consortiumManagementAccountAddress; set { {_consortiumManagementAccountAddress = value;} } } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.Dns { get => this._dns; set { {_dns = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.PublicKey { get => this._publicKey; set { {_publicKey = value;} } } + + /// Internal Acessors for RootContractAddress + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.RootContractAddress { get => this._rootContractAddress; set { {_rootContractAddress = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.UserName { get => this._userName; set { {_userName = value;} } } + + /// Internal Acessors for ValidatorNodesSku + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesInternal.ValidatorNodesSku { get => (this._validatorNodesSku = this._validatorNodesSku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku()); set { {_validatorNodesSku = value;} } } + + /// Backing field for property. + private string _password; + + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? _protocol; + + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => this._protocol; set => this._protocol = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? _provisioningState; + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publicKey; + + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; } + + /// Backing field for property. + private string _rootContractAddress; + + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string RootContractAddress { get => this._rootContractAddress; } + + /// Backing field for property. + private string _userName; + + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string UserName { get => this._userName; } + + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public int? ValidatorNodeSkuCapacity { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)ValidatorNodesSku).Capacity; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSkuInternal)ValidatorNodesSku).Capacity = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku _validatorNodesSku; + + /// Gets or sets the blockchain validator nodes Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get => (this._validatorNodesSku = this._validatorNodesSku ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku()); set => this._validatorNodesSku = value; } + + /// Creates an new instance. + public BlockchainMemberProperties() + { + + } + } + /// Payload of the blockchain member properties for a blockchain member. + public partial interface IBlockchainMemberProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the consortium for the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + string Consortium { get; set; } + /// Gets the managed consortium management account address. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the managed consortium management account address.", + SerializedName = @"consortiumManagementAccountAddress", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountAddress { get; } + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the dns endpoint of the blockchain member.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets firewall rules + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain protocol. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; } + /// Gets the public key of the blockchain member (default transaction node). + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the public key of the blockchain member (default transaction node).", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets the Ethereum root contract address of the blockchain. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the Ethereum root contract address of the blockchain.", + SerializedName = @"rootContractAddress", + PossibleTypes = new [] { typeof(string) })] + string RootContractAddress { get; } + /// Gets the auth user name of the blockchain member. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets the auth user name of the blockchain member.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + /// Gets or sets the nodes capacity. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + int? ValidatorNodeSkuCapacity { get; set; } + + } + /// Payload of the blockchain member properties for a blockchain member. + internal partial interface IBlockchainMemberPropertiesInternal + + { + /// Gets or sets the consortium for the blockchain member. + string Consortium { get; set; } + /// Gets the managed consortium management account address. + string ConsortiumManagementAccountAddress { get; set; } + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets the display name of the member in the consortium. + string ConsortiumMemberDisplayName { get; set; } + /// Gets the role of the member in the consortium. + string ConsortiumRole { get; set; } + /// Gets the dns endpoint of the blockchain member. + string Dns { get; set; } + /// Gets or sets firewall rules + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the basic auth password of the blockchain member. + string Password { get; set; } + /// Gets or sets the blockchain protocol. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState? ProvisioningState { get; set; } + /// Gets the public key of the blockchain member (default transaction node). + string PublicKey { get; set; } + /// Gets the Ethereum root contract address of the blockchain. + string RootContractAddress { get; set; } + /// Gets the auth user name of the blockchain member. + string UserName { get; set; } + /// Gets or sets the nodes capacity. + int? ValidatorNodeSkuCapacity { get; set; } + /// Gets or sets the blockchain validator nodes Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberNodesSku ValidatorNodesSku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs new file mode 100644 index 000000000000..130d4ea588fe --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberProperties.json.cs @@ -0,0 +1,153 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberProperties(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_validatorNodesSku = If( json?.PropertyT("validatorNodesSku"), out var __jsonValidatorNodesSku) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberNodesSku.FromJson(__jsonValidatorNodesSku) : ValidatorNodesSku;} + {_consortium = If( json?.PropertyT("consortium"), out var __jsonConsortium) ? (string)__jsonConsortium : (string)Consortium;} + {_consortiumManagementAccountAddress = If( json?.PropertyT("consortiumManagementAccountAddress"), out var __jsonConsortiumManagementAccountAddress) ? (string)__jsonConsortiumManagementAccountAddress : (string)ConsortiumManagementAccountAddress;} + {_consortiumManagementAccountPassword = If( json?.PropertyT("consortiumManagementAccountPassword"), out var __jsonConsortiumManagementAccountPassword) ? (string)__jsonConsortiumManagementAccountPassword : (string)ConsortiumManagementAccountPassword;} + {_consortiumMemberDisplayName = If( json?.PropertyT("consortiumMemberDisplayName"), out var __jsonConsortiumMemberDisplayName) ? (string)__jsonConsortiumMemberDisplayName : (string)ConsortiumMemberDisplayName;} + {_consortiumRole = If( json?.PropertyT("consortiumRole"), out var __jsonConsortiumRole) ? (string)__jsonConsortiumRole : (string)ConsortiumRole;} + {_dns = If( json?.PropertyT("dns"), out var __jsonDns) ? (string)__jsonDns : (string)Dns;} + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + {_rootContractAddress = If( json?.PropertyT("rootContractAddress"), out var __jsonRootContractAddress) ? (string)__jsonRootContractAddress : (string)RootContractAddress;} + {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)UserName;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._validatorNodesSku ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._validatorNodesSku.ToJson(null,serializationMode) : null, "validatorNodesSku" ,container.Add ); + AddIf( null != (((object)this._consortium)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortium.ToString()) : null, "consortium" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._consortiumManagementAccountAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountAddress.ToString()) : null, "consortiumManagementAccountAddress" ,container.Add ); + } + AddIf( null != (((object)this._consortiumManagementAccountPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountPassword.ToString()) : null, "consortiumManagementAccountPassword" ,container.Add ); + AddIf( null != (((object)this._consortiumMemberDisplayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumMemberDisplayName.ToString()) : null, "consortiumMemberDisplayName" ,container.Add ); + AddIf( null != (((object)this._consortiumRole)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumRole.ToString()) : null, "consortiumRole" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dns)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dns.ToString()) : null, "dns" ,container.Add ); + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._rootContractAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._rootContractAddress.ToString()) : null, "rootContractAddress" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); + } + AddIf( null != (((object)this._protocol)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._protocol.ToString()) : null, "protocol" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs new file mode 100644 index 000000000000..58cef75ebfa4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Update the payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesUpdateTypeConverter))] + public partial class BlockchainMemberPropertiesUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberPropertiesUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberPropertiesUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberPropertiesUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberPropertiesUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Update the payload of the blockchain member properties for a blockchain member. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberPropertiesUpdateTypeConverter))] + public partial interface IBlockchainMemberPropertiesUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs new file mode 100644 index 000000000000..29eb9f7a5c7f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberPropertiesUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberPropertiesUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberPropertiesUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberPropertiesUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs new file mode 100644 index 000000000000..94b84d31cf4b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.cs @@ -0,0 +1,73 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberPropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate __transactionNodePropertiesUpdate = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate(); + + /// Backing field for property. + private string _consortiumManagementAccountPassword; + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ConsortiumManagementAccountPassword { get => this._consortiumManagementAccountPassword; set => this._consortiumManagementAccountPassword = value; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).FirewallRule = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)__transactionNodePropertiesUpdate).Password = value; } + + /// Creates an new instance. + public BlockchainMemberPropertiesUpdate() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__transactionNodePropertiesUpdate), __transactionNodePropertiesUpdate); + await eventListener.AssertObjectIsValid(nameof(__transactionNodePropertiesUpdate), __transactionNodePropertiesUpdate); + } + } + /// Update the payload of the blockchain member properties for a blockchain member. + public partial interface IBlockchainMemberPropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate + { + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + + } + /// Update the payload of the blockchain member properties for a blockchain member. + internal partial interface IBlockchainMemberPropertiesUpdateInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal + { + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs new file mode 100644 index 000000000000..123c832a872b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberPropertiesUpdate.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the payload of the blockchain member properties for a blockchain member. + public partial class BlockchainMemberPropertiesUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberPropertiesUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __transactionNodePropertiesUpdate = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate(json); + {_consortiumManagementAccountPassword = If( json?.PropertyT("consortiumManagementAccountPassword"), out var __jsonConsortiumManagementAccountPassword) ? (string)__jsonConsortiumManagementAccountPassword : (string)ConsortiumManagementAccountPassword;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberPropertiesUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __transactionNodePropertiesUpdate?.ToJson(container, serializationMode); + AddIf( null != (((object)this._consortiumManagementAccountPassword)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._consortiumManagementAccountPassword.ToString()) : null, "consortiumManagementAccountPassword" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs new file mode 100644 index 000000000000..e55637b468bb --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTypeConverter))] + public partial class BlockchainMemberUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword = (string) content.GetValueForProperty("ConsortiumManagementAccountPassword",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal)this).ConsortiumManagementAccountPassword, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTypeConverter))] + public partial interface IBlockchainMemberUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs new file mode 100644 index 000000000000..a60ac8e0bdef --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs new file mode 100644 index 000000000000..1498827bf229 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.cs @@ -0,0 +1,108 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal + { + + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string ConsortiumManagementAccountPassword { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)Property).ConsortiumManagementAccountPassword; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdateInternal)Property).ConsortiumManagementAccountPassword = value; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate()); set { {_property = value;} } } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate _property; + + /// Gets or sets the blockchain member update properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate()); set => this._property = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags _tag; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags()); set => this._tag = value; } + + /// Creates an new instance. + public BlockchainMemberUpdate() + { + + } + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + public partial interface IBlockchainMemberUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Sets the managed consortium management account password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + string ConsortiumManagementAccountPassword { get; set; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get; set; } + + } + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + internal partial interface IBlockchainMemberUpdateInternal + + { + /// Sets the managed consortium management account password. + string ConsortiumManagementAccountPassword { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member update properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberPropertiesUpdate Property { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs new file mode 100644 index 000000000000..76e4b495d1ce --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdate.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + public partial class BlockchainMemberUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainMemberUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberPropertiesUpdate.FromJson(__jsonProperties) : Property;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs new file mode 100644 index 000000000000..e963258ef2d8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTagsTypeConverter))] + public partial class BlockchainMemberUpdateTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainMemberUpdateTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainMemberUpdateTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainMemberUpdateTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainMemberUpdateTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Tags of the service which is a list of key value pairs that describes the resource. + [System.ComponentModel.TypeConverter(typeof(BlockchainMemberUpdateTagsTypeConverter))] + public partial interface IBlockchainMemberUpdateTags + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs new file mode 100644 index 000000000000..fb231741d9a8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainMemberUpdateTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainMemberUpdateTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainMemberUpdateTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainMemberUpdateTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs new file mode 100644 index 000000000000..4826aef82c30 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class BlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTagsInternal + { + + /// Creates an new instance. + public BlockchainMemberUpdateTags() + { + + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + public partial interface IBlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + + } + /// Tags of the service which is a list of key value pairs that describes the resource. + internal partial interface IBlockchainMemberUpdateTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs new file mode 100644 index 000000000000..ed992cc8d2fd --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainMemberUpdateTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdateTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs new file mode 100644 index 000000000000..a606902ba78f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/BlockchainMemberUpdateTags.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class BlockchainMemberUpdateTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + /// + internal BlockchainMemberUpdateTags(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainMemberUpdateTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs new file mode 100644 index 000000000000..50d7a2171ba0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Consortium payload + [System.ComponentModel.TypeConverter(typeof(ConsortiumTypeConverter))] + public partial class Consortium + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Consortium(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Consortium(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol?) content.GetValueForProperty("Protocol",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal)this).Protocol, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol.CreateFrom); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Consortium(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Consortium(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Consortium payload + [System.ComponentModel.TypeConverter(typeof(ConsortiumTypeConverter))] + public partial interface IConsortium + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs new file mode 100644 index 000000000000..c466631f490f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Consortium.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Consortium.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Consortium.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs new file mode 100644 index 000000000000..b0edb141e1b9 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium payload + public partial class Consortium : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets the blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? _protocol; + + /// Gets or sets the protocol for the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get => this._protocol; set => this._protocol = value; } + + /// Creates an new instance. + public Consortium() + { + + } + } + /// Consortium payload + public partial interface IConsortium : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain member name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the protocol for the consortium. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the protocol for the consortium.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + + } + /// Consortium payload + internal partial interface IConsortiumInternal + + { + /// Gets or sets the blockchain member name. + string Name { get; set; } + /// Gets or sets the protocol for the consortium. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol? Protocol { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs new file mode 100644 index 000000000000..33916347f796 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Consortium.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium payload + public partial class Consortium + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Consortium(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_protocol = If( json?.PropertyT("protocol"), out var __jsonProtocol) ? (string)__jsonProtocol : (string)Protocol;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Consortium(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._protocol)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._protocol.ToString()) : null, "protocol" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs new file mode 100644 index 000000000000..8944babf4328 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of the consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumCollectionTypeConverter))] + public partial class ConsortiumCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumCollectionTypeConverter))] + public partial interface IConsortiumCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs new file mode 100644 index 000000000000..fa1ecae2703d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs new file mode 100644 index 000000000000..ae5a8dee40e9 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the consortium payload. + public partial class ConsortiumCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] _value; + + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ConsortiumCollection() + { + + } + } + /// Collection of the consortium payload. + public partial interface IConsortiumCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of consortiums.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get; set; } + + } + /// Collection of the consortium payload. + internal partial interface IConsortiumCollectionInternal + + { + /// Gets or sets the collection of consortiums. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs new file mode 100644 index 000000000000..153ef1a471ea --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumCollection.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the consortium payload. + public partial class ConsortiumCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Consortium.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs new file mode 100644 index 000000000000..8118a8be8253 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Consortium approval + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberTypeConverter))] + public partial class ConsortiumMember + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumMember(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified = (global::System.DateTime?) content.GetValueForProperty("DateModified",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate = (global::System.DateTime?) content.GetValueForProperty("JoinDate",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumMember(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified = (global::System.DateTime?) content.GetValueForProperty("DateModified",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DateModified, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName = (string) content.GetValueForProperty("DisplayName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).DisplayName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate = (global::System.DateTime?) content.GetValueForProperty("JoinDate",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).JoinDate, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role = (string) content.GetValueForProperty("Role",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Role, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status = (string) content.GetValueForProperty("Status",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).Status, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal)this).SubscriptionId, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumMember(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumMember(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Consortium approval + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberTypeConverter))] + public partial interface IConsortiumMember + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs new file mode 100644 index 000000000000..ed0876c1c3db --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumMemberTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumMember.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumMember.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumMember.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs new file mode 100644 index 000000000000..c8c5e5600436 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.cs @@ -0,0 +1,148 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium approval + public partial class ConsortiumMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberInternal + { + + /// Backing field for property. + private global::System.DateTime? _dateModified; + + /// Gets the consortium member modified date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? DateModified { get => this._dateModified; set => this._dateModified = value; } + + /// Backing field for property. + private string _displayName; + + /// Gets the consortium member display name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string DisplayName { get => this._displayName; set => this._displayName = value; } + + /// Backing field for property. + private global::System.DateTime? _joinDate; + + /// Gets the consortium member join date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? JoinDate { get => this._joinDate; set => this._joinDate = value; } + + /// Backing field for property. + private string _name; + + /// Gets the consortium member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _role; + + /// Gets the consortium member role. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Role { get => this._role; set => this._role = value; } + + /// Backing field for property. + private string _status; + + /// Gets the consortium member status. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Status { get => this._status; set => this._status = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// Gets the consortium member subscription id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Creates an new instance. + public ConsortiumMember() + { + + } + } + /// Consortium approval + public partial interface IConsortiumMember : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets the consortium member modified date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member modified date.", + SerializedName = @"dateModified", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? DateModified { get; set; } + /// Gets the consortium member display name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member display name.", + SerializedName = @"displayName", + PossibleTypes = new [] { typeof(string) })] + string DisplayName { get; set; } + /// Gets the consortium member join date. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member join date.", + SerializedName = @"joinDate", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? JoinDate { get; set; } + /// Gets the consortium member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets the consortium member role. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member role.", + SerializedName = @"role", + PossibleTypes = new [] { typeof(string) })] + string Role { get; set; } + /// Gets the consortium member status. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member status.", + SerializedName = @"status", + PossibleTypes = new [] { typeof(string) })] + string Status { get; set; } + /// Gets the consortium member subscription id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the consortium member subscription id.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + + } + /// Consortium approval + internal partial interface IConsortiumMemberInternal + + { + /// Gets the consortium member modified date. + global::System.DateTime? DateModified { get; set; } + /// Gets the consortium member display name. + string DisplayName { get; set; } + /// Gets the consortium member join date. + global::System.DateTime? JoinDate { get; set; } + /// Gets the consortium member name. + string Name { get; set; } + /// Gets the consortium member role. + string Role { get; set; } + /// Gets the consortium member status. + string Status { get; set; } + /// Gets the consortium member subscription id. + string SubscriptionId { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs new file mode 100644 index 000000000000..1d498aec5785 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMember.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Consortium approval + public partial class ConsortiumMember + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumMember(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_dateModified = If( json?.PropertyT("dateModified"), out var __jsonDateModified) ? global::System.DateTime.TryParse((string)__jsonDateModified, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonDateModifiedValue) ? __jsonDateModifiedValue : DateModified : DateModified;} + {_displayName = If( json?.PropertyT("displayName"), out var __jsonDisplayName) ? (string)__jsonDisplayName : (string)DisplayName;} + {_joinDate = If( json?.PropertyT("joinDate"), out var __jsonJoinDate) ? global::System.DateTime.TryParse((string)__jsonJoinDate, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonJoinDateValue) ? __jsonJoinDateValue : JoinDate : JoinDate;} + {_role = If( json?.PropertyT("role"), out var __jsonRole) ? (string)__jsonRole : (string)Role;} + {_status = If( json?.PropertyT("status"), out var __jsonStatus) ? (string)__jsonStatus : (string)Status;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumMember(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._dateModified ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dateModified?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "dateModified" ,container.Add ); + AddIf( null != (((object)this._displayName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._displayName.ToString()) : null, "displayName" ,container.Add ); + AddIf( null != this._joinDate ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._joinDate?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "joinDate" ,container.Add ); + AddIf( null != (((object)this._role)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._role.ToString()) : null, "role" ,container.Add ); + AddIf( null != (((object)this._status)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._status.ToString()) : null, "status" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs new file mode 100644 index 000000000000..6af57915c166 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberCollectionTypeConverter))] + public partial class ConsortiumMemberCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ConsortiumMemberCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ConsortiumMemberCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMemberTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ConsortiumMemberCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ConsortiumMemberCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of consortium payload. + [System.ComponentModel.TypeConverter(typeof(ConsortiumMemberCollectionTypeConverter))] + public partial interface IConsortiumMemberCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs new file mode 100644 index 000000000000..98723f3933ab --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ConsortiumMemberCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ConsortiumMemberCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ConsortiumMemberCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ConsortiumMemberCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs new file mode 100644 index 000000000000..21a599ecfbdb --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.cs @@ -0,0 +1,73 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of consortium payload. + public partial class ConsortiumMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] _value; + + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ConsortiumMemberCollection() + { + + } + } + /// Collection of consortium payload. + public partial interface IConsortiumMemberCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of consortiums. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of consortiums.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get; set; } + + } + /// Collection of consortium payload. + internal partial interface IConsortiumMemberCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of consortiums. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs new file mode 100644 index 000000000000..91861a53b2d7 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ConsortiumMemberCollection.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of consortium payload. + public partial class ConsortiumMemberCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ConsortiumMemberCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ConsortiumMember.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMemberCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ConsortiumMemberCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs new file mode 100644 index 000000000000..0d2866757b32 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Ip range for firewall rules + [System.ComponentModel.TypeConverter(typeof(FirewallRuleTypeConverter))] + public partial class FirewallRule + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new FirewallRule(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new FirewallRule(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal FirewallRule(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress = (string) content.GetValueForProperty("EndIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName = (string) content.GetValueForProperty("RuleName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress = (string) content.GetValueForProperty("StartIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal FirewallRule(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress = (string) content.GetValueForProperty("EndIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).EndIPAddress, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName = (string) content.GetValueForProperty("RuleName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).RuleName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress = (string) content.GetValueForProperty("StartIPAddress",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal)this).StartIPAddress, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Ip range for firewall rules + [System.ComponentModel.TypeConverter(typeof(FirewallRuleTypeConverter))] + public partial interface IFirewallRule + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs new file mode 100644 index 000000000000..7b9a9baf4540 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class FirewallRuleTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return FirewallRule.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return FirewallRule.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return FirewallRule.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs new file mode 100644 index 000000000000..17ba3202d577 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.cs @@ -0,0 +1,80 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Ip range for firewall rules + public partial class FirewallRule : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRuleInternal + { + + /// Backing field for property. + private string _endIPAddress; + + /// Gets or sets the end IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string EndIPAddress { get => this._endIPAddress; set => this._endIPAddress = value; } + + /// Backing field for property. + private string _ruleName; + + /// Gets or sets the name of the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string RuleName { get => this._ruleName; set => this._ruleName = value; } + + /// Backing field for property. + private string _startIPAddress; + + /// Gets or sets the start IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string StartIPAddress { get => this._startIPAddress; set => this._startIPAddress = value; } + + /// Creates an new instance. + public FirewallRule() + { + + } + } + /// Ip range for firewall rules + public partial interface IFirewallRule : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the end IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the end IP address of the firewall rule range.", + SerializedName = @"endIpAddress", + PossibleTypes = new [] { typeof(string) })] + string EndIPAddress { get; set; } + /// Gets or sets the name of the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the firewall rules.", + SerializedName = @"ruleName", + PossibleTypes = new [] { typeof(string) })] + string RuleName { get; set; } + /// Gets or sets the start IP address of the firewall rule range. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the start IP address of the firewall rule range.", + SerializedName = @"startIpAddress", + PossibleTypes = new [] { typeof(string) })] + string StartIPAddress { get; set; } + + } + /// Ip range for firewall rules + internal partial interface IFirewallRuleInternal + + { + /// Gets or sets the end IP address of the firewall rule range. + string EndIPAddress { get; set; } + /// Gets or sets the name of the firewall rules. + string RuleName { get; set; } + /// Gets or sets the start IP address of the firewall rule range. + string StartIPAddress { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs new file mode 100644 index 000000000000..7ef7ace00178 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/FirewallRule.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Ip range for firewall rules + public partial class FirewallRule + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal FirewallRule(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_endIPAddress = If( json?.PropertyT("endIpAddress"), out var __jsonEndIPAddress) ? (string)__jsonEndIPAddress : (string)EndIPAddress;} + {_ruleName = If( json?.PropertyT("ruleName"), out var __jsonRuleName) ? (string)__jsonRuleName : (string)RuleName;} + {_startIPAddress = If( json?.PropertyT("startIpAddress"), out var __jsonStartIPAddress) ? (string)__jsonStartIPAddress : (string)StartIPAddress;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new FirewallRule(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._endIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._endIPAddress.ToString()) : null, "endIpAddress" ,container.Add ); + AddIf( null != (((object)this._ruleName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._ruleName.ToString()) : null, "ruleName" ,container.Add ); + AddIf( null != (((object)this._startIPAddress)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._startIPAddress.ToString()) : null, "startIpAddress" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs new file mode 100644 index 000000000000..a65985838f00 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityTypeConverter))] + public partial class NameAvailability + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NameAvailability(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NameAvailability(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NameAvailability(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason?) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason.CreateFrom); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NameAvailability(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message = (string) content.GetValueForProperty("Message",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Message, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable = (bool?) content.GetValueForProperty("NameAvailable",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).NameAvailable, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason?) content.GetValueForProperty("Reason",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal)this).Reason, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason.CreateFrom); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Name availability payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityTypeConverter))] + public partial interface INameAvailability + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs new file mode 100644 index 000000000000..d40e577cb40b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NameAvailabilityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NameAvailability.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NameAvailability.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NameAvailability.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs new file mode 100644 index 000000000000..5e0c4214b1b6 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.cs @@ -0,0 +1,82 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + public partial class NameAvailability : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityInternal + { + + /// Backing field for property. + private string _message; + + /// Gets or sets the message. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Message { get => this._message; set => this._message = value; } + + /// Backing field for property. + private bool? _nameAvailable; + + /// Gets or sets the value indicating whether the name is available. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public bool? NameAvailable { get => this._nameAvailable; set => this._nameAvailable = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? _reason; + + /// Gets or sets the name availability reason. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get => this._reason; set => this._reason = value; } + + /// Creates an new instance. + public NameAvailability() + { + + } + } + /// Name availability payload which is exposed in the response of the resource provider. + public partial interface INameAvailability : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the message. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the message.", + SerializedName = @"message", + PossibleTypes = new [] { typeof(string) })] + string Message { get; set; } + /// Gets or sets the value indicating whether the name is available. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the value indicating whether the name is available.", + SerializedName = @"nameAvailable", + PossibleTypes = new [] { typeof(bool) })] + bool? NameAvailable { get; set; } + /// Gets or sets the name availability reason. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name availability reason.", + SerializedName = @"reason", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get; set; } + + } + /// Name availability payload which is exposed in the response of the resource provider. + internal partial interface INameAvailabilityInternal + + { + /// Gets or sets the message. + string Message { get; set; } + /// Gets or sets the value indicating whether the name is available. + bool? NameAvailable { get; set; } + /// Gets or sets the name availability reason. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason? Reason { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs new file mode 100644 index 000000000000..bbbd15448d59 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailability.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability payload which is exposed in the response of the resource provider. + /// + public partial class NameAvailability + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new NameAvailability(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal NameAvailability(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_message = If( json?.PropertyT("message"), out var __jsonMessage) ? (string)__jsonMessage : (string)Message;} + {_nameAvailable = If( json?.PropertyT("nameAvailable"), out var __jsonNameAvailable) ? (bool?)__jsonNameAvailable : NameAvailable;} + {_reason = If( json?.PropertyT("reason"), out var __jsonReason) ? (string)__jsonReason : (string)Reason;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._message)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._message.ToString()) : null, "message" ,container.Add ); + AddIf( null != this._nameAvailable ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonBoolean((bool)this._nameAvailable) : null, "nameAvailable" ,container.Add ); + AddIf( null != (((object)this._reason)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._reason.ToString()) : null, "reason" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs new file mode 100644 index 000000000000..ae9c323beebf --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityRequestTypeConverter))] + public partial class NameAvailabilityRequest + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new NameAvailabilityRequest(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new NameAvailabilityRequest(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal NameAvailabilityRequest(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal NameAvailabilityRequest(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal)this).Type, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Name availability request payload which is exposed in the request of the resource provider. + [System.ComponentModel.TypeConverter(typeof(NameAvailabilityRequestTypeConverter))] + public partial interface INameAvailabilityRequest + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs new file mode 100644 index 000000000000..ed3936510961 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class NameAvailabilityRequestTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return NameAvailabilityRequest.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return NameAvailabilityRequest.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return NameAvailabilityRequest.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs new file mode 100644 index 000000000000..593c798711d8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + public partial class NameAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequestInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets the name to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _type; + + /// Gets or sets the type of the resource to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Type { get => this._type; set => this._type = value; } + + /// Creates an new instance. + public NameAvailabilityRequest() + { + + } + } + /// Name availability request payload which is exposed in the request of the resource provider. + public partial interface INameAvailabilityRequest : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the name to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name to check.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the type of the resource to check. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of the resource to check.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; set; } + + } + /// Name availability request payload which is exposed in the request of the resource provider. + internal partial interface INameAvailabilityRequestInternal + + { + /// Gets or sets the name to check. + string Name { get; set; } + /// Gets or sets the type of the resource to check. + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs new file mode 100644 index 000000000000..63635686c57e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/NameAvailabilityRequest.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + public partial class NameAvailabilityRequest + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new NameAvailabilityRequest(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal NameAvailabilityRequest(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs new file mode 100644 index 000000000000..78d30a3116af --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(OperationResultTypeConverter))] + public partial class OperationResult + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new OperationResult(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new OperationResult(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal OperationResult(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal OperationResult(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime = (global::System.DateTime?) content.GetValueForProperty("EndTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).EndTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime = (global::System.DateTime?) content.GetValueForProperty("StartTime",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal)this).StartTime, (v) => v is global::System.DateTime _v ? _v : global::System.Xml.XmlConvert.ToDateTime( v.ToString() , global::System.Xml.XmlDateTimeSerializationMode.Unspecified)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation result payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(OperationResultTypeConverter))] + public partial interface IOperationResult + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs new file mode 100644 index 000000000000..3c3dd68b6f01 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class OperationResultTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return OperationResult.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return OperationResult.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return OperationResult.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs new file mode 100644 index 000000000000..19ec9c808d01 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.cs @@ -0,0 +1,82 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + public partial class OperationResult : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResultInternal + { + + /// Backing field for property. + private global::System.DateTime? _endTime; + + /// Gets or sets the operation end time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? EndTime { get => this._endTime; set => this._endTime = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private global::System.DateTime? _startTime; + + /// Gets or sets the operation start time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public global::System.DateTime? StartTime { get => this._startTime; set => this._startTime = value; } + + /// Creates an new instance. + public OperationResult() + { + + } + } + /// Operation result payload which is exposed in the response of the resource provider. + public partial interface IOperationResult : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the operation end time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation end time.", + SerializedName = @"endTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the operation start time. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation start time.", + SerializedName = @"startTime", + PossibleTypes = new [] { typeof(global::System.DateTime) })] + global::System.DateTime? StartTime { get; set; } + + } + /// Operation result payload which is exposed in the response of the resource provider. + internal partial interface IOperationResultInternal + + { + /// Gets or sets the operation end time. + global::System.DateTime? EndTime { get; set; } + /// Gets or sets the operation name. + string Name { get; set; } + /// Gets or sets the operation start time. + global::System.DateTime? StartTime { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs new file mode 100644 index 000000000000..2ea176deb1ec --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/OperationResult.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation result payload which is exposed in the response of the resource provider. + /// + public partial class OperationResult + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IOperationResult FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new OperationResult(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal OperationResult(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_endTime = If( json?.PropertyT("endTime"), out var __jsonEndTime) ? global::System.DateTime.TryParse((string)__jsonEndTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonEndTimeValue) ? __jsonEndTimeValue : EndTime : EndTime;} + {_startTime = If( json?.PropertyT("startTime"), out var __jsonStartTime) ? global::System.DateTime.TryParse((string)__jsonStartTime, global::System.Globalization.CultureInfo.InvariantCulture, global::System.Globalization.DateTimeStyles.AdjustToUniversal, out var __jsonStartTimeValue) ? __jsonStartTimeValue : StartTime : StartTime;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._endTime ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._endTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "endTime" ,container.Add ); + AddIf( null != this._startTime ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._startTime?.ToString(@"yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",global::System.Globalization.CultureInfo.InvariantCulture)) : null, "startTime" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs new file mode 100644 index 000000000000..3d0aeead2354 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.PowerShell.cs @@ -0,0 +1,135 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// The core properties of the resources. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial class Resource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Resource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Resource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Resource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Resource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// The core properties of the resources. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeConverter))] + public partial interface IResource + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs new file mode 100644 index 000000000000..75a5af159550 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Resource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Resource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Resource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs new file mode 100644 index 000000000000..b044ca3d1d37 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.cs @@ -0,0 +1,89 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The core properties of the resources. + public partial class Resource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + + /// Backing field for property. + private string _id; + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Id { get => this._id; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => this._id; set { {_id = value;} } } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => this._name; set { {_name = value;} } } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => this._type; set { {_type = value;} } } + + /// Backing field for property. + private string _name; + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; } + + /// Backing field for property. + private string _type; + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Type { get => this._type; } + + /// Creates an new instance. + public Resource() + { + + } + } + /// The core properties of the resources. + public partial interface IResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Fully qualified resource Id of the resource.", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; } + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The name of the resource.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; } + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"The type of the service - e.g. ""Microsoft.Blockchain""", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + string Type { get; } + + } + /// The core properties of the resources. + internal partial interface IResourceInternal + + { + /// Fully qualified resource Id of the resource. + string Id { get; set; } + /// The name of the resource. + string Name { get; set; } + /// The type of the service - e.g. "Microsoft.Blockchain" + string Type { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs new file mode 100644 index 000000000000..c6d79939feba --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Resource.json.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The core properties of the resources. + public partial class Resource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Resource(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Resource(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_type = If( json?.PropertyT("type"), out var __jsonType) ? (string)__jsonType : (string)Type;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._type)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._type.ToString()) : null, "type" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs new file mode 100644 index 000000000000..a39d6a42caf8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.PowerShell.cs @@ -0,0 +1,147 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationTypeConverter))] + public partial class ResourceProviderOperation + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperation(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperation(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperation(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperation(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay) content.GetValueForProperty("Display",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Display, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplayTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction = (bool?) content.GetValueForProperty("IsDataAction",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).IsDataAction, (__y)=> (bool) global::System.Convert.ChangeType(__y, typeof(bool))); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin = (string) content.GetValueForProperty("Origin",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).Origin, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription = (string) content.GetValueForProperty("DisplayDescription",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayDescription, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation = (string) content.GetValueForProperty("DisplayOperation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayOperation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider = (string) content.GetValueForProperty("DisplayProvider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayProvider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource = (string) content.GetValueForProperty("DisplayResource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal)this).DisplayResource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationTypeConverter))] + public partial interface IResourceProviderOperation + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs new file mode 100644 index 000000000000..2c5e7899e2d4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperation.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperation.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperation.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs new file mode 100644 index 000000000000..03949863f65a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.cs @@ -0,0 +1,148 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Operation payload which is exposed in the response of the resource provider. + public partial class ResourceProviderOperation : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay _display; + + /// Gets or sets operation display + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay()); set => this._display = value; } + + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayDescription { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Description; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Description = value; } + + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayOperation { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Operation; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Operation = value; } + + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayProvider { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Provider; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Provider = value; } + + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string DisplayResource { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Resource; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)Display).Resource = value; } + + /// Backing field for property. + private bool? _isDataAction; + + /// Gets or sets a value indicating whether the operation is a data action or not. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public bool? IsDataAction { get => this._isDataAction; set => this._isDataAction = value; } + + /// Internal Acessors for Display + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationInternal.Display { get => (this._display = this._display ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay()); set { {_display = value;} } } + + /// Backing field for property. + private string _name; + + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _origin; + + /// Gets or sets the origin. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Origin { get => this._origin; set => this._origin = value; } + + /// Creates an new instance. + public ResourceProviderOperation() + { + + } + } + /// Operation payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperation : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description of the provider for display purposes.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string DisplayDescription { get; set; } + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the operation for display purposes.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string DisplayOperation { get; set; } + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the provider for display purposes.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string DisplayProvider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the resource type for display purposes.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string DisplayResource { get; set; } + /// Gets or sets a value indicating whether the operation is a data action or not. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets a value indicating whether the operation is a data action or not.", + SerializedName = @"isDataAction", + PossibleTypes = new [] { typeof(bool) })] + bool? IsDataAction { get; set; } + /// Gets or sets the operation name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the operation name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the origin. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the origin.", + SerializedName = @"origin", + PossibleTypes = new [] { typeof(string) })] + string Origin { get; set; } + + } + /// Operation payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationInternal + + { + /// Gets or sets operation display + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay Display { get; set; } + /// Gets or sets the description of the provider for display purposes. + string DisplayDescription { get; set; } + /// Gets or sets the name of the operation for display purposes. + string DisplayOperation { get; set; } + /// Gets or sets the name of the provider for display purposes. + string DisplayProvider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + string DisplayResource { get; set; } + /// Gets or sets a value indicating whether the operation is a data action or not. + bool? IsDataAction { get; set; } + /// Gets or sets the operation name. + string Name { get; set; } + /// Gets or sets the origin. + string Origin { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs new file mode 100644 index 000000000000..c5e72e017a0d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperation.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Operation payload which is exposed in the response of the resource provider. + public partial class ResourceProviderOperation + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperation(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperation(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_display = If( json?.PropertyT("display"), out var __jsonDisplay) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationDisplay.FromJson(__jsonDisplay) : Display;} + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_isDataAction = If( json?.PropertyT("isDataAction"), out var __jsonIsDataAction) ? (bool?)__jsonIsDataAction : IsDataAction;} + {_origin = If( json?.PropertyT("origin"), out var __jsonOrigin) ? (string)__jsonOrigin : (string)Origin;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._display ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._display.ToJson(null,serializationMode) : null, "display" ,container.Add ); + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != this._isDataAction ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode)new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonBoolean((bool)this._isDataAction) : null, "isDataAction" ,container.Add ); + AddIf( null != (((object)this._origin)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._origin.ToString()) : null, "origin" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs new file mode 100644 index 000000000000..430f03558d82 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationCollectionTypeConverter))] + public partial class ResourceProviderOperationCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperationCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperationCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperationCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperationCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperationTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of operation payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationCollectionTypeConverter))] + public partial interface IResourceProviderOperationCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs new file mode 100644 index 000000000000..d413010dde86 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.TypeConverter.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise + /// false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperationCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperationCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperationCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs new file mode 100644 index 000000000000..d851b2b848b4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] _value; + + /// Gets or sets the collection of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ResourceProviderOperationCollection() + { + + } + } + /// Collection of operation payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperationCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of operations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of operations.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get; set; } + + } + /// Collection of operation payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of operations. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs new file mode 100644 index 000000000000..b08ba5c12e02 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationCollection.json.cs @@ -0,0 +1,114 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of operation payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperationCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperationCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceProviderOperation.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs new file mode 100644 index 000000000000..8a2fed6e99fe --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.PowerShell.cs @@ -0,0 +1,141 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationDisplayTypeConverter))] + public partial class ResourceProviderOperationDisplay + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceProviderOperationDisplay(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceProviderOperationDisplay(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceProviderOperationDisplay(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceProviderOperationDisplay(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description = (string) content.GetValueForProperty("Description",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Description, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation = (string) content.GetValueForProperty("Operation",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Operation, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider = (string) content.GetValueForProperty("Provider",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Provider, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource = (string) content.GetValueForProperty("Resource",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal)this).Resource, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Operation display payload which is exposed in the response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(ResourceProviderOperationDisplayTypeConverter))] + public partial interface IResourceProviderOperationDisplay + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs new file mode 100644 index 000000000000..49cc07d9699d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceProviderOperationDisplayTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceProviderOperationDisplay.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceProviderOperationDisplay.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceProviderOperationDisplay.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs new file mode 100644 index 000000000000..ac7faf160fcc --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.cs @@ -0,0 +1,99 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplayInternal + { + + /// Backing field for property. + private string _description; + + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Description { get => this._description; set => this._description = value; } + + /// Backing field for property. + private string _operation; + + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Operation { get => this._operation; set => this._operation = value; } + + /// Backing field for property. + private string _provider; + + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Provider { get => this._provider; set => this._provider = value; } + + /// Backing field for property. + private string _resource; + + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Resource { get => this._resource; set => this._resource = value; } + + /// Creates an new instance. + public ResourceProviderOperationDisplay() + { + + } + } + /// Operation display payload which is exposed in the response of the resource provider. + public partial interface IResourceProviderOperationDisplay : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the description of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the description of the provider for display purposes.", + SerializedName = @"description", + PossibleTypes = new [] { typeof(string) })] + string Description { get; set; } + /// Gets or sets the name of the operation for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the operation for display purposes.", + SerializedName = @"operation", + PossibleTypes = new [] { typeof(string) })] + string Operation { get; set; } + /// Gets or sets the name of the provider for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the provider for display purposes.", + SerializedName = @"provider", + PossibleTypes = new [] { typeof(string) })] + string Provider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name of the resource type for display purposes.", + SerializedName = @"resource", + PossibleTypes = new [] { typeof(string) })] + string Resource { get; set; } + + } + /// Operation display payload which is exposed in the response of the resource provider. + internal partial interface IResourceProviderOperationDisplayInternal + + { + /// Gets or sets the description of the provider for display purposes. + string Description { get; set; } + /// Gets or sets the name of the operation for display purposes. + string Operation { get; set; } + /// Gets or sets the name of the provider for display purposes. + string Provider { get; set; } + /// Gets or sets the name of the resource type for display purposes. + string Resource { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs new file mode 100644 index 000000000000..db98858273a2 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceProviderOperationDisplay.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Operation display payload which is exposed in the response of the resource provider. + /// + public partial class ResourceProviderOperationDisplay + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperationDisplay FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceProviderOperationDisplay(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceProviderOperationDisplay(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_description = If( json?.PropertyT("description"), out var __jsonDescription) ? (string)__jsonDescription : (string)Description;} + {_operation = If( json?.PropertyT("operation"), out var __jsonOperation) ? (string)__jsonOperation : (string)Operation;} + {_provider = If( json?.PropertyT("provider"), out var __jsonProvider) ? (string)__jsonProvider : (string)Provider;} + {_resource = If( json?.PropertyT("resource"), out var __jsonResource) ? (string)__jsonResource : (string)Resource;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._description)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._description.ToString()) : null, "description" ,container.Add ); + AddIf( null != (((object)this._operation)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._operation.ToString()) : null, "operation" ,container.Add ); + AddIf( null != (((object)this._provider)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provider.ToString()) : null, "provider" ,container.Add ); + AddIf( null != (((object)this._resource)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resource.ToString()) : null, "resource" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs new file mode 100644 index 000000000000..2ba7601fff2a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuTypeConverter))] + public partial class ResourceTypeSku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTypeSku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTypeSku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTypeSku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[]) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSettingTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTypeSku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType = (string) content.GetValueForProperty("ResourceType",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).ResourceType, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[]) content.GetValueForProperty("Sku",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal)this).Sku, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSettingTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuTypeConverter))] + public partial interface IResourceTypeSku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs new file mode 100644 index 000000000000..db54cd47862d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeSkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTypeSku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTypeSku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTypeSku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs new file mode 100644 index 000000000000..ca12c0a9d510 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Resource type Sku. + public partial class ResourceTypeSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuInternal + { + + /// Backing field for property. + private string _resourceType; + + /// Gets or sets the resource type + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ResourceType { get => this._resourceType; set => this._resourceType = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] _sku; + + /// Gets or sets the Skus + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get => this._sku; set => this._sku = value; } + + /// Creates an new instance. + public ResourceTypeSku() + { + + } + } + /// Resource type Sku. + public partial interface IResourceTypeSku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the resource type + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the resource type", + SerializedName = @"resourceType", + PossibleTypes = new [] { typeof(string) })] + string ResourceType { get; set; } + /// Gets or sets the Skus + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Skus", + SerializedName = @"skus", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get; set; } + + } + /// Resource type Sku. + internal partial interface IResourceTypeSkuInternal + + { + /// Gets or sets the resource type + string ResourceType { get; set; } + /// Gets or sets the Skus + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting[] Sku { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs new file mode 100644 index 000000000000..2505d9e5e76c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSku.json.cs @@ -0,0 +1,111 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Resource type Sku. + public partial class ResourceTypeSku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceTypeSku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceTypeSku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_resourceType = If( json?.PropertyT("resourceType"), out var __jsonResourceType) ? (string)__jsonResourceType : (string)ResourceType;} + {_sku = If( json?.PropertyT("skus"), out var __jsonSkus) ? If( __jsonSkus as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.SkuSetting.FromJson(__u) )) ))() : null : Sku;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._resourceType)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resourceType.ToString()) : null, "resourceType" ,container.Add ); + if (null != this._sku) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._sku ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("skus",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs new file mode 100644 index 000000000000..773020c1ad9e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Collection of the resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuCollectionTypeConverter))] + public partial class ResourceTypeSkuCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new ResourceTypeSkuCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new ResourceTypeSkuCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal ResourceTypeSkuCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal ResourceTypeSkuCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSkuTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Collection of the resource type Sku. + [System.ComponentModel.TypeConverter(typeof(ResourceTypeSkuCollectionTypeConverter))] + public partial interface IResourceTypeSkuCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs new file mode 100644 index 000000000000..67b827570eef --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class ResourceTypeSkuCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return ResourceTypeSkuCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return ResourceTypeSkuCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return ResourceTypeSkuCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs new file mode 100644 index 000000000000..de00c3e71b74 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.cs @@ -0,0 +1,46 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the resource type Sku. + public partial class ResourceTypeSkuCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollectionInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] _value; + + /// Gets or sets the collection of resource type Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public ResourceTypeSkuCollection() + { + + } + } + /// Collection of the resource type Sku. + public partial interface IResourceTypeSkuCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the collection of resource type Sku. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of resource type Sku.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get; set; } + + } + /// Collection of the resource type Sku. + internal partial interface IResourceTypeSkuCollectionInternal + + { + /// Gets or sets the collection of resource type Sku. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs new file mode 100644 index 000000000000..e881b24854af --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/ResourceTypeSkuCollection.json.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Collection of the resource type Sku. + public partial class ResourceTypeSkuCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSkuCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new ResourceTypeSkuCollection(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal ResourceTypeSkuCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ResourceTypeSku.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs new file mode 100644 index 000000000000..98de7ccf3026 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.PowerShell.cs @@ -0,0 +1,133 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Blockchain member Sku in payload + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial class Sku + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new Sku(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new Sku(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal Sku(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal Sku(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Blockchain member Sku in payload + [System.ComponentModel.TypeConverter(typeof(SkuTypeConverter))] + public partial interface ISku + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs new file mode 100644 index 000000000000..9e82631a1be8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return Sku.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return Sku.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return Sku.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs new file mode 100644 index 000000000000..a7dea32d61e0 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.cs @@ -0,0 +1,63 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Blockchain member Sku in payload + public partial class Sku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuInternal + { + + /// Backing field for property. + private string _name; + + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string _tier; + + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Tier { get => this._tier; set => this._tier = value; } + + /// Creates an new instance. + public Sku() + { + + } + } + /// Blockchain member Sku in payload + public partial interface ISku : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets Sku name + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets Sku tier + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string Tier { get; set; } + + } + /// Blockchain member Sku in payload + internal partial interface ISkuInternal + + { + /// Gets or sets Sku name + string Name { get; set; } + /// Gets or sets Sku tier + string Tier { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs new file mode 100644 index 000000000000..722897b7fc7e --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/Sku.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Blockchain member Sku in payload + public partial class Sku + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISku FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new Sku(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal Sku(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_tier = If( json?.PropertyT("tier"), out var __jsonTier) ? (string)__jsonTier : (string)Tier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + AddIf( null != (((object)this._tier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._tier.ToString()) : null, "tier" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs new file mode 100644 index 000000000000..32c2ae789d3c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Sku Setting. + [System.ComponentModel.TypeConverter(typeof(SkuSettingTypeConverter))] + public partial class SkuSetting + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new SkuSetting(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new SkuSetting(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal SkuSetting(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location = (string[]) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature = (string[]) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal SkuSetting(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location = (string[]) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Location, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature = (string[]) content.GetValueForProperty("RequiredFeature",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).RequiredFeature, __y => TypeConverterExtensions.SelectToArray(__y, global::System.Convert.ToString)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier = (string) content.GetValueForProperty("Tier",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal)this).Tier, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + /// Sku Setting. + [System.ComponentModel.TypeConverter(typeof(SkuSettingTypeConverter))] + public partial interface ISkuSetting + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs new file mode 100644 index 000000000000..27575ef9caca --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class SkuSettingTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return SkuSetting.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return SkuSetting.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return SkuSetting.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs new file mode 100644 index 000000000000..5ea37fe4da29 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.cs @@ -0,0 +1,97 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Sku Setting. + public partial class SkuSetting : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSettingInternal + { + + /// Backing field for property. + private string[] _location; + + /// Gets or sets the locations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string[] Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _name; + + /// Gets or sets the Sku name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Name { get => this._name; set => this._name = value; } + + /// Backing field for property. + private string[] _requiredFeature; + + /// Gets or sets the required features. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string[] RequiredFeature { get => this._requiredFeature; set => this._requiredFeature = value; } + + /// Backing field for property. + private string _tier; + + /// Gets or sets the Sku tier. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Tier { get => this._tier; set => this._tier = value; } + + /// Creates an new instance. + public SkuSetting() + { + + } + } + /// Sku Setting. + public partial interface ISkuSetting : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the locations. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the locations.", + SerializedName = @"locations", + PossibleTypes = new [] { typeof(string) })] + string[] Location { get; set; } + /// Gets or sets the Sku name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sku name.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + string Name { get; set; } + /// Gets or sets the required features. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the required features.", + SerializedName = @"requiredFeatures", + PossibleTypes = new [] { typeof(string) })] + string[] RequiredFeature { get; set; } + /// Gets or sets the Sku tier. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the Sku tier.", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + string Tier { get; set; } + + } + /// Sku Setting. + internal partial interface ISkuSettingInternal + + { + /// Gets or sets the locations. + string[] Location { get; set; } + /// Gets or sets the Sku name. + string Name { get; set; } + /// Gets or sets the required features. + string[] RequiredFeature { get; set; } + /// Gets or sets the Sku tier. + string Tier { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs new file mode 100644 index 000000000000..067eb934dc77 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/SkuSetting.json.cs @@ -0,0 +1,123 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Sku Setting. + public partial class SkuSetting + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ISkuSetting FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new SkuSetting(json) : null; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal SkuSetting(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_name = If( json?.PropertyT("name"), out var __jsonName) ? (string)__jsonName : (string)Name;} + {_location = If( json?.PropertyT("locations"), out var __jsonLocations) ? If( __jsonLocations as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(string) (__u is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString __t ? (string)(__t.ToString()) : null)) ))() : null : Location;} + {_requiredFeature = If( json?.PropertyT("requiredFeatures"), out var __jsonRequiredFeatures) ? If( __jsonRequiredFeatures as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __q) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__q, (__p)=>(string) (__p is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString __o ? (string)(__o.ToString()) : null)) ))() : null : RequiredFeature;} + {_tier = If( json?.PropertyT("tier"), out var __jsonTier) ? (string)__jsonTier : (string)Tier;} + AfterFromJson(json); + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._name)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._name.ToString()) : null, "name" ,container.Add ); + if (null != this._location) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._location ) + { + AddIf(null != (((object)__x)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(__x.ToString()) : null ,__w.Add); + } + container.Add("locations",__w); + } + if (null != this._requiredFeature) + { + var __r = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __s in this._requiredFeature ) + { + AddIf(null != (((object)__s)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(__s.ToString()) : null ,__r.Add); + } + container.Add("requiredFeatures",__r); + } + AddIf( null != (((object)this._tier)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._tier.ToString()) : null, "tier" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs new file mode 100644 index 000000000000..01d3e952fb16 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// The resource model definition for a top level resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial class TrackedResource + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResource(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResource(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResource(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResource(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) content.GetValueForProperty("Tag",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal)this).Tag, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTagsTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// The resource model definition for a top level resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTypeConverter))] + public partial interface ITrackedResource + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs new file mode 100644 index 000000000000..044183dd19e8 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResource.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResource.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs new file mode 100644 index 000000000000..0eb37374e947 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.cs @@ -0,0 +1,109 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The resource model definition for a top level resource. + public partial class TrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(); + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags _tag; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => (this._tag = this._tag ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags()); set => this._tag = value; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; } + + /// Creates an new instance. + public TrackedResource() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// The resource model definition for a top level resource. + public partial interface ITrackedResource : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource + { + /// The GEO location of the blockchain service. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GEO location of the blockchain service.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get; set; } + + } + /// The resource model definition for a top level resource. + internal partial interface ITrackedResourceInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + /// The GEO location of the blockchain service. + string Location { get; set; } + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs new file mode 100644 index 000000000000..2e361b35c33a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResource.json.cs @@ -0,0 +1,105 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// The resource model definition for a top level resource. + public partial class TrackedResource + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResource FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TrackedResource(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != this._tag ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._tag.ToJson(null,serializationMode) : null, "tags" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TrackedResource(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(json); + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_tag = If( json?.PropertyT("tags"), out var __jsonTags) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags.FromJson(__jsonTags) : Tag;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs new file mode 100644 index 000000000000..db1c1bdda9df --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial class TrackedResourceTags + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TrackedResourceTags(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TrackedResourceTags(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TrackedResourceTags(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TrackedResourceTags(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + // this type is a dictionary; copy elements from source to here. + CopyFrom(content); + AfterDeserializePSObject(content); + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + [System.ComponentModel.TypeConverter(typeof(TrackedResourceTagsTypeConverter))] + public partial interface ITrackedResourceTags + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs new file mode 100644 index 000000000000..fd2f75e18216 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TrackedResourceTagsTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TrackedResourceTags.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TrackedResourceTags.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs new file mode 100644 index 000000000000..c7932352bdb3 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.cs @@ -0,0 +1,32 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTagsInternal + { + + /// Creates an new instance. + public TrackedResourceTags() + { + + } + } + /// Tags of the service which is a list of key value pairs that describes the resource. + public partial interface ITrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + + } + /// Tags of the service which is a list of key value pairs that describes the resource. + internal partial interface ITrackedResourceTagsInternal + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs new file mode 100644 index 000000000000..cf14c471be1a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.dictionary.cs @@ -0,0 +1,70 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class TrackedResourceTags : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray + { + protected global::System.Collections.Generic.Dictionary __additionalProperties = new global::System.Collections.Generic.Dictionary(); + + global::System.Collections.Generic.IDictionary Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.AdditionalProperties { get => __additionalProperties; } + + int Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Count { get => __additionalProperties.Count; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Keys { get => __additionalProperties.Keys; } + + global::System.Collections.Generic.IEnumerable Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray.Values { get => __additionalProperties.Values; } + + public string this[global::System.String index] { get => __additionalProperties[index]; set => __additionalProperties[index] = value; } + + /// + /// + public void Add(global::System.String key, string value) => __additionalProperties.Add( key, value); + + public void Clear() => __additionalProperties.Clear(); + + /// + public bool ContainsKey(global::System.String key) => __additionalProperties.ContainsKey( key); + + /// + public void CopyFrom(global::System.Collections.IDictionary source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public void CopyFrom(global::System.Management.Automation.PSObject source) + { + if (null != source) + { + foreach( var property in Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.TypeConverterExtensions.GetFilteredProperties(source, new global::System.Collections.Generic.HashSet() { } ) ) + { + if ((null != property.Key && null != property.Value)) + { + this.__additionalProperties.Add(property.Key.ToString(), global::System.Management.Automation.LanguagePrimitives.ConvertTo( property.Value)); + } + } + } + } + + /// + public bool Remove(global::System.String key) => __additionalProperties.Remove( key); + + /// + /// + public bool TryGetValue(global::System.String key, out string value) => __additionalProperties.TryGetValue( key, out value); + + /// + + public static implicit operator global::System.Collections.Generic.Dictionary(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TrackedResourceTags source) => source.__additionalProperties; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs new file mode 100644 index 000000000000..dfc23ff6c7d7 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TrackedResourceTags.json.cs @@ -0,0 +1,104 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + public partial class TrackedResourceTags + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TrackedResourceTags(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, container); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + /// + internal TrackedResourceTags(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, global::System.Collections.Generic.HashSet exclusions = null) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson( json, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IAssociativeArray)this).AdditionalProperties, null ,exclusions ); + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs new file mode 100644 index 000000000000..15a0e7feb561 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.PowerShell.cs @@ -0,0 +1,153 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeTypeConverter))] + public partial class TransactionNode + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNode(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNode(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNode(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNode(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name = (string) content.GetValueForProperty("Name",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Name, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type = (string) content.GetValueForProperty("Type",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Type, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Payload of the transaction node which is the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeTypeConverter))] + public partial interface ITransactionNode + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs new file mode 100644 index 000000000000..0176db2bf484 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNode.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNode.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNode.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs new file mode 100644 index 000000000000..98dad61abb63 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.cs @@ -0,0 +1,196 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + public partial class TransactionNode : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates + { + /// + /// Backing field for Inherited model + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(); + + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns; } + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).FirewallRule = value; } + + /// Fully qualified resource Id of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; } + + /// Backing field for property. + private string _location; + + /// Gets or sets the transaction node location. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Internal Acessors for Id + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Id { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Id = value; } + + /// Internal Acessors for Name + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name = value; } + + /// Internal Acessors for Type + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal.Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.Dns { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Dns = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties()); set { {_property = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState = value; } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey = value; } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeInternal.UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName = value; } + + /// The name of the resource. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Name { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Name; } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties _property; + + /// Gets or sets the blockchain member properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties()); set => this._property = value; } + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).ProvisioningState; } + + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string PublicKey { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).PublicKey; } + + /// The type of the service - e.g. "Microsoft.Blockchain" + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inherited)] + public string Type { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal)__resource).Type; } + + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string UserName { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)Property).UserName; } + + /// Creates an new instance. + public TransactionNode() + { + + } + + /// Validates that this object meets the validation criteria. + /// an instance that will receive validation + /// events. + /// + /// A < see cref = "global::System.Threading.Tasks.Task" /> that will be complete when validation is completed. + /// + public async global::System.Threading.Tasks.Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener eventListener) + { + await eventListener.AssertNotNull(nameof(__resource), __resource); + await eventListener.AssertObjectIsValid(nameof(__resource), __resource); + } + } + /// Payload of the transaction node which is the request/response of the resource provider. + public partial interface ITransactionNode : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResource + { + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Gets or sets the transaction node location. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the transaction node location.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; } + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node public key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint basic auth user name.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + + } + /// Payload of the transaction node which is the request/response of the resource provider. + internal partial interface ITransactionNodeInternal : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceInternal + { + /// Gets or sets the transaction node dns endpoint. + string Dns { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Gets or sets the transaction node location. + string Location { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties Property { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the transaction node public key. + string PublicKey { get; set; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + string UserName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs new file mode 100644 index 000000000000..91b2c303d88f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNode.json.cs @@ -0,0 +1,107 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + public partial class TransactionNode + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNode(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + __resource?.ToJson(container, serializationMode); + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNode(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + __resource = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.Resource(json); + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeProperties.FromJson(__jsonProperties) : Property;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs new file mode 100644 index 000000000000..02c31b73ae5b --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeCollectionTypeConverter))] + public partial class TransactionNodeCollection + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeCollection(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeCollection(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeCollection(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeTypeConverter.ConvertFrom)); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeCollection(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink = (string) content.GetValueForProperty("NextLink",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).NextLink, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[]) content.GetValueForProperty("Value",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal)this).Value, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeTypeConverter.ConvertFrom)); + AfterDeserializePSObject(content); + } + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeCollectionTypeConverter))] + public partial interface ITransactionNodeCollection + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs new file mode 100644 index 000000000000..9e8ff2905951 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeCollectionTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeCollection.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeCollection.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeCollection.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs new file mode 100644 index 000000000000..671644b2e474 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.cs @@ -0,0 +1,75 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollectionInternal + { + + /// Backing field for property. + private string _nextLink; + + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string NextLink { get => this._nextLink; set => this._nextLink = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] _value; + + /// Gets or sets the collection of transaction nodes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get => this._value; set => this._value = value; } + + /// Creates an new instance. + public TransactionNodeCollection() + { + + } + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + public partial interface ITransactionNodeCollection : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + It's null for now, added for future use.", + SerializedName = @"nextLink", + PossibleTypes = new [] { typeof(string) })] + string NextLink { get; set; } + /// Gets or sets the collection of transaction nodes. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the collection of transaction nodes.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get; set; } + + } + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + internal partial interface ITransactionNodeCollectionInternal + + { + /// + /// Gets or sets the URL, that the client should use to fetch the next page (per server side paging). + /// It's null for now, added for future use. + /// + string NextLink { get; set; } + /// Gets or sets the collection of transaction nodes. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode[] Value { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs new file mode 100644 index 000000000000..049d3c91095d --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeCollection.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Collection of transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeCollection + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeCollection FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeCollection(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._nextLink)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._nextLink.ToString()) : null, "nextLink" ,container.Add ); + if (null != this._value) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._value ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("value",__w); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeCollection(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_nextLink = If( json?.PropertyT("nextLink"), out var __jsonNextLink) ? (string)__jsonNextLink : (string)NextLink;} + {_value = If( json?.PropertyT("value"), out var __jsonValue) ? If( __jsonValue as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode.FromJson(__u) )) ))() : null : Value;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs new file mode 100644 index 000000000000..fec1ebb2abd4 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.PowerShell.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// Payload of transaction node properties payload in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesTypeConverter))] + public partial class TransactionNodeProperties + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeProperties(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeProperties(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeProperties(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeProperties(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns = (string) content.GetValueForProperty("Dns",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Dns, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).Password, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState?) content.GetValueForProperty("ProvisioningState",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).ProvisioningState, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState.CreateFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey = (string) content.GetValueForProperty("PublicKey",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).PublicKey, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName = (string) content.GetValueForProperty("UserName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal)this).UserName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Payload of transaction node properties payload in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesTypeConverter))] + public partial interface ITransactionNodeProperties + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs new file mode 100644 index 000000000000..886b18bea90a --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodePropertiesTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeProperties.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeProperties.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeProperties.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs new file mode 100644 index 000000000000..fcc192f6ee84 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.cs @@ -0,0 +1,143 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of transaction node properties payload in the transaction node payload. + public partial class TransactionNodeProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal + { + + /// Backing field for property. + private string _dns; + + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Dns { get => this._dns; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Internal Acessors for Dns + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.Dns { get => this._dns; set { {_dns = value;} } } + + /// Internal Acessors for ProvisioningState + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.ProvisioningState { get => this._provisioningState; set { {_provisioningState = value;} } } + + /// Internal Acessors for PublicKey + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.PublicKey { get => this._publicKey; set { {_publicKey = value;} } } + + /// Internal Acessors for UserName + string Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesInternal.UserName { get => this._userName; set { {_userName = value;} } } + + /// Backing field for property. + private string _password; + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? _provisioningState; + + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get => this._provisioningState; } + + /// Backing field for property. + private string _publicKey; + + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string PublicKey { get => this._publicKey; } + + /// Backing field for property. + private string _userName; + + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string UserName { get => this._userName; } + + /// Creates an new instance. + public TransactionNodeProperties() + { + + } + } + /// Payload of transaction node properties payload in the transaction node payload. + public partial interface ITransactionNodeProperties : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the transaction node dns endpoint. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint.", + SerializedName = @"dns", + PossibleTypes = new [] { typeof(string) })] + string Dns { get; } + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the blockchain member provision state.", + SerializedName = @"provisioningState", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; } + /// Gets or sets the transaction node public key. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node public key.", + SerializedName = @"publicKey", + PossibleTypes = new [] { typeof(string) })] + string PublicKey { get; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = true, + Description = @"Gets or sets the transaction node dns endpoint basic auth user name.", + SerializedName = @"userName", + PossibleTypes = new [] { typeof(string) })] + string UserName { get; } + + } + /// Payload of transaction node properties payload in the transaction node payload. + internal partial interface ITransactionNodePropertiesInternal + + { + /// Gets or sets the transaction node dns endpoint. + string Dns { get; set; } + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the blockchain member provision state. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState? ProvisioningState { get; set; } + /// Gets or sets the transaction node public key. + string PublicKey { get; set; } + /// Gets or sets the transaction node dns endpoint basic auth user name. + string UserName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs new file mode 100644 index 000000000000..70224d1d945f --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeProperties.json.cs @@ -0,0 +1,131 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Payload of transaction node properties payload in the transaction node payload. + public partial class TransactionNodeProperties + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeProperties FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeProperties(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._dns)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._dns.ToString()) : null, "dns" ,container.Add ); + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._provisioningState)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._provisioningState.ToString()) : null, "provisioningState" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._publicKey)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._publicKey.ToString()) : null, "publicKey" ,container.Add ); + } + if (serializationMode.HasFlag(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeReadOnly)) + { + AddIf( null != (((object)this._userName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._userName.ToString()) : null, "userName" ,container.Add ); + } + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeProperties(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_dns = If( json?.PropertyT("dns"), out var __jsonDns) ? (string)__jsonDns : (string)Dns;} + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + {_provisioningState = If( json?.PropertyT("provisioningState"), out var __jsonProvisioningState) ? (string)__jsonProvisioningState : (string)ProvisioningState;} + {_publicKey = If( json?.PropertyT("publicKey"), out var __jsonPublicKey) ? (string)__jsonPublicKey : (string)PublicKey;} + {_userName = If( json?.PropertyT("userName"), out var __jsonUserName) ? (string)__jsonUserName : (string)UserName;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs new file mode 100644 index 000000000000..a1b14f4b1b74 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.PowerShell.cs @@ -0,0 +1,137 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesUpdateTypeConverter))] + public partial class TransactionNodePropertiesUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodePropertiesUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodePropertiesUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodePropertiesUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodePropertiesUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Update the payload of the transaction node properties in the transaction node payload. + [System.ComponentModel.TypeConverter(typeof(TransactionNodePropertiesUpdateTypeConverter))] + public partial interface ITransactionNodePropertiesUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs new file mode 100644 index 000000000000..b2d28264ca7c --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodePropertiesUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodePropertiesUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodePropertiesUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodePropertiesUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs new file mode 100644 index 000000000000..34769b7d7fa2 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.cs @@ -0,0 +1,65 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + public partial class TransactionNodePropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal + { + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] _firewallRule; + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => this._firewallRule; set => this._firewallRule = value; } + + /// Backing field for property. + private string _password; + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Password { get => this._password; set => this._password = value; } + + /// Creates an new instance. + public TransactionNodePropertiesUpdate() + { + + } + } + /// Update the payload of the transaction node properties in the transaction node payload. + public partial interface ITransactionNodePropertiesUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + + } + /// Update the payload of the transaction node properties in the transaction node payload. + internal partial interface ITransactionNodePropertiesUpdateInternal + + { + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs new file mode 100644 index 000000000000..af3d4171d010 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodePropertiesUpdate.json.cs @@ -0,0 +1,113 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the payload of the transaction node properties in the transaction node payload. + /// + public partial class TransactionNodePropertiesUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodePropertiesUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + if (null != this._firewallRule) + { + var __w = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.XNodeArray(); + foreach( var __x in this._firewallRule ) + { + AddIf(__x?.ToJson(null, serializationMode) ,__w.Add); + } + container.Add("firewallRules",__w); + } + AddIf( null != (((object)this._password)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._password.ToString()) : null, "password" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodePropertiesUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_firewallRule = If( json?.PropertyT("firewallRules"), out var __jsonFirewallRules) ? If( __jsonFirewallRules as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonArray, out var __v) ? new global::System.Func(()=> global::System.Linq.Enumerable.ToArray(global::System.Linq.Enumerable.Select(__v, (__u)=>(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRule.FromJson(__u) )) ))() : null : FirewallRule;} + {_password = If( json?.PropertyT("password"), out var __jsonPassword) ? (string)__jsonPassword : (string)Password;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs new file mode 100644 index 000000000000..aec5fa837f43 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.PowerShell.cs @@ -0,0 +1,139 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + [System.ComponentModel.TypeConverter(typeof(TransactionNodeUpdateTypeConverter))] + public partial class TransactionNodeUpdate + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new TransactionNodeUpdate(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new TransactionNodeUpdate(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal TransactionNodeUpdate(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal TransactionNodeUpdate(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate) content.GetValueForProperty("Property",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Property, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdateTypeConverter.ConvertFrom); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule = (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]) content.GetValueForProperty("FirewallRule",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).FirewallRule, __y => TypeConverterExtensions.SelectToArray(__y, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.FirewallRuleTypeConverter.ConvertFrom)); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password = (string) content.GetValueForProperty("Password",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal)this).Password, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + [System.ComponentModel.TypeConverter(typeof(TransactionNodeUpdateTypeConverter))] + public partial interface ITransactionNodeUpdate + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs new file mode 100644 index 000000000000..83a25b824faa --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.TypeConverter.cs @@ -0,0 +1,142 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class TransactionNodeUpdateTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return TransactionNodeUpdate.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return TransactionNodeUpdate.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return TransactionNodeUpdate.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs new file mode 100644 index 000000000000..ed3b4417ab65 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.cs @@ -0,0 +1,71 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal + { + + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).FirewallRule = value; } + + /// Internal Acessors for Property + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdateInternal.Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate()); set { {_property = value;} } } + + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Inlined)] + public string Password { get => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password; set => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdateInternal)Property).Password = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate _property; + + /// Gets or sets the transaction node update properties. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + internal Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Property { get => (this._property = this._property ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate()); set => this._property = value; } + + /// Creates an new instance. + public TransactionNodeUpdate() + { + + } + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + public partial interface ITransactionNodeUpdate : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Gets or sets the firewall rules. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + string Password { get; set; } + + } + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + internal partial interface ITransactionNodeUpdateInternal + + { + /// Gets or sets the firewall rules. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get; set; } + /// Sets the transaction node dns endpoint basic auth password. + string Password { get; set; } + /// Gets or sets the transaction node update properties. + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodePropertiesUpdate Property { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs new file mode 100644 index 000000000000..771a5cc74cf3 --- /dev/null +++ b/src/Blockchain/generated/api/Models/Api20180601Preview/TransactionNodeUpdate.json.cs @@ -0,0 +1,103 @@ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + public partial class TransactionNodeUpdate + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new TransactionNodeUpdate(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != this._property ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) this._property.ToJson(null,serializationMode) : null, "properties" ,container.Add ); + AfterToJson(ref container); + return container; + } + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal TransactionNodeUpdate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_property = If( json?.PropertyT("properties"), out var __jsonProperties) ? Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodePropertiesUpdate.FromJson(__jsonProperties) : Property;} + AfterFromJson(json); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs new file mode 100644 index 000000000000..9e98423a5f68 --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.PowerShell.cs @@ -0,0 +1,146 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + [System.ComponentModel.TypeConverter(typeof(BlockchainIdentityTypeConverter))] + public partial class BlockchainIdentity + { + + /// + /// AfterDeserializeDictionary will be called after the deserialization has finished, allowing customization of the + /// object before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Collections.IDictionary content that should be used. + + partial void AfterDeserializeDictionary(global::System.Collections.IDictionary content); + + /// + /// AfterDeserializePSObject will be called after the deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The global::System.Management.Automation.PSObject content that should be used. + + partial void AfterDeserializePSObject(global::System.Management.Automation.PSObject content); + + /// + /// BeforeDeserializeDictionary will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Collections.IDictionary content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializeDictionary(global::System.Collections.IDictionary content, ref bool returnNow); + + /// + /// BeforeDeserializePSObject will be called before the deserialization has commenced, allowing complete customization + /// of the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeDeserializePSObject(global::System.Management.Automation.PSObject content, ref bool returnNow); + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + internal BlockchainIdentity(global::System.Collections.IDictionary content) + { + bool returnNow = false; + BeforeDeserializeDictionary(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName = (string) content.GetValueForProperty("BlockchainMemberName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName = (string) content.GetValueForProperty("TransactionNodeName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName, global::System.Convert.ToString); + AfterDeserializeDictionary(content); + } + + /// + /// Deserializes a into a new instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + internal BlockchainIdentity(global::System.Management.Automation.PSObject content) + { + bool returnNow = false; + BeforeDeserializePSObject(content, ref returnNow); + if (returnNow) + { + return; + } + // actually deserialize + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId = (string) content.GetValueForProperty("OperationId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).OperationId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName = (string) content.GetValueForProperty("BlockchainMemberName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).BlockchainMemberName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id = (string) content.GetValueForProperty("Id",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Id, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location = (string) content.GetValueForProperty("Location",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).Location, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName = (string) content.GetValueForProperty("ResourceGroupName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).ResourceGroupName, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId = (string) content.GetValueForProperty("SubscriptionId",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).SubscriptionId, global::System.Convert.ToString); + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName = (string) content.GetValueForProperty("TransactionNodeName",((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal)this).TransactionNodeName, global::System.Convert.ToString); + AfterDeserializePSObject(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Collections.IDictionary content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity DeserializeFromDictionary(global::System.Collections.IDictionary content) + { + return new BlockchainIdentity(content); + } + + /// + /// Deserializes a into an instance of . + /// + /// The global::System.Management.Automation.PSObject content that should be used. + /// + /// an instance of . + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity DeserializeFromPSObject(global::System.Management.Automation.PSObject content) + { + return new BlockchainIdentity(content); + } + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + /// Serializes this instance to a json string. + + /// a containing this model serialized to JSON text. + public string ToJsonString() => ToJson(null, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode.IncludeAll)?.ToString(); + } + [System.ComponentModel.TypeConverter(typeof(BlockchainIdentityTypeConverter))] + public partial interface IBlockchainIdentity + + { + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs new file mode 100644 index 000000000000..6d021b07e90d --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.TypeConverter.cs @@ -0,0 +1,157 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell; + + /// + /// A PowerShell PSTypeConverter to support converting to an instance of + /// + public partial class BlockchainIdentityTypeConverter : global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + // we allow string conversion too. + if (type == typeof(global::System.String)) + { + return true; + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + // support direct string to id type conversion. + if (type == typeof(global::System.String)) + { + return new BlockchainIdentity { Id = sourceValue }; + } + if (typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return BlockchainIdentity.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString());; + } + catch + { + // Unable to use JSON pattern + } + if (typeof(global::System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return BlockchainIdentity.DeserializeFromPSObject(sourceValue); + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return BlockchainIdentity.DeserializeFromDictionary(sourceValue); + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.cs new file mode 100644 index 000000000000..4faa1288dc16 --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.cs @@ -0,0 +1,168 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentityInternal + { + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Backing field for property. + private string _id; + + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Id { get => this._id; set => this._id = value; } + + /// Backing field for property. + private string _location; + + /// Location Name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string Location { get => this._location; set => this._location = value; } + + /// Backing field for property. + private string _operationId; + + /// Operation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string OperationId { get => this._operationId; set => this._operationId = value; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Origin(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.PropertyOrigin.Owned)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// Creates an new instance. + public BlockchainIdentity() + { + + } + } + public partial interface IBlockchainIdentity : + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable + { + /// Blockchain member name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + string BlockchainMemberName { get; set; } + /// Resource identity path + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Resource identity path", + SerializedName = @"id", + PossibleTypes = new [] { typeof(string) })] + string Id { get; set; } + /// Location Name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + string Location { get; set; } + /// Operation Id. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Operation Id.", + SerializedName = @"operationId", + PossibleTypes = new [] { typeof(string) })] + string OperationId { get; set; } + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + string ResourceGroupName { get; set; } + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + string SubscriptionId { get; set; } + /// Transaction node name. + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + string TransactionNodeName { get; set; } + + } + internal partial interface IBlockchainIdentityInternal + + { + /// Blockchain member name. + string BlockchainMemberName { get; set; } + /// Resource identity path + string Id { get; set; } + /// Location Name. + string Location { get; set; } + /// Operation Id. + string OperationId { get; set; } + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + string ResourceGroupName { get; set; } + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + string SubscriptionId { get; set; } + /// Transaction node name. + string TransactionNodeName { get; set; } + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs b/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs new file mode 100644 index 000000000000..7032f22fedbf --- /dev/null +++ b/src/Blockchain/generated/api/Models/BlockchainIdentity.json.cs @@ -0,0 +1,117 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public partial class BlockchainIdentity + { + + /// + /// AfterFromJson will be called after the json deserialization has finished, allowing customization of the object + /// before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JsonNode that should be deserialized into this object. + + partial void AfterFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json); + + /// + /// AfterToJson will be called after the json erialization has finished, allowing customization of the before it is returned. Implement this method in a partial class to enable this behavior + /// + /// The JSON container that the serialization result will be placed in. + + partial void AfterToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container); + + /// + /// BeforeFromJson will be called before the json deserialization has commenced, allowing complete customization of + /// the object before it is deserialized. + /// If you wish to disable the default deserialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JsonNode that should be deserialized into this object. + /// Determines if the rest of the deserialization should be processed, or if the method should return + /// instantly. + + partial void BeforeFromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json, ref bool returnNow); + + /// + /// BeforeToJson will be called before the json serialization has commenced, allowing complete customization of the + /// object before it is serialized. + /// If you wish to disable the default serialization entirely, return true in the output parameter. + /// Implement this method in a partial class to enable this behavior. + /// + /// The JSON container that the serialization result will be placed in. + /// Determines if the rest of the serialization should be processed, or if the method should return + /// instantly. + + partial void BeforeToJson(ref Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, ref bool returnNow); + + /// + /// Deserializes a Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject into a new instance of . + /// + /// A Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject instance to deserialize from. + internal BlockchainIdentity(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + bool returnNow = false; + BeforeFromJson(json, ref returnNow); + if (returnNow) + { + return; + } + {_operationId = If( json?.PropertyT("operationId"), out var __jsonOperationId) ? (string)__jsonOperationId : (string)OperationId;} + {_blockchainMemberName = If( json?.PropertyT("blockchainMemberName"), out var __jsonBlockchainMemberName) ? (string)__jsonBlockchainMemberName : (string)BlockchainMemberName;} + {_id = If( json?.PropertyT("id"), out var __jsonId) ? (string)__jsonId : (string)Id;} + {_location = If( json?.PropertyT("location"), out var __jsonLocation) ? (string)__jsonLocation : (string)Location;} + {_resourceGroupName = If( json?.PropertyT("resourceGroupName"), out var __jsonResourceGroupName) ? (string)__jsonResourceGroupName : (string)ResourceGroupName;} + {_subscriptionId = If( json?.PropertyT("subscriptionId"), out var __jsonSubscriptionId) ? (string)__jsonSubscriptionId : (string)SubscriptionId;} + {_transactionNodeName = If( json?.PropertyT("transactionNodeName"), out var __jsonTransactionNodeName) ? (string)__jsonTransactionNodeName : (string)TransactionNodeName;} + AfterFromJson(json); + } + + /// + /// Deserializes a into an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity. + /// + /// a to deserialize from. + /// + /// an instance of Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity. + /// + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new BlockchainIdentity(json) : null; + } + + /// + /// Serializes this instance of into a . + /// + /// The container to serialize this object into. If the caller + /// passes in null, a new instance will be created and returned to the caller. + /// Allows the caller to choose the depth of the serialization. See . + /// + /// a serialized instance of as a . + /// + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode ToJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject container, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SerializationMode serializationMode) + { + container = container ?? new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject(); + + bool returnNow = false; + BeforeToJson(ref container, ref returnNow); + if (returnNow) + { + return container; + } + AddIf( null != (((object)this._operationId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._operationId.ToString()) : null, "operationId" ,container.Add ); + AddIf( null != (((object)this._blockchainMemberName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._blockchainMemberName.ToString()) : null, "blockchainMemberName" ,container.Add ); + AddIf( null != (((object)this._id)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._id.ToString()) : null, "id" ,container.Add ); + AddIf( null != (((object)this._location)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._location.ToString()) : null, "location" ,container.Add ); + AddIf( null != (((object)this._resourceGroupName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._resourceGroupName.ToString()) : null, "resourceGroupName" ,container.Add ); + AddIf( null != (((object)this._subscriptionId)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._subscriptionId.ToString()) : null, "subscriptionId" ,container.Add ); + AddIf( null != (((object)this._transactionNodeName)?.ToString()) ? (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode) new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonString(this._transactionNodeName.ToString()) : null, "transactionNodeName" ,container.Add ); + AfterToJson(ref container); + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs new file mode 100644 index 000000000000..c93f93dbe0a7 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.Completer.cs @@ -0,0 +1,55 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for BlockchainMemberProvisioningState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningStateTypeConverter))] + public partial struct BlockchainMemberProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Updating", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Deleting", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Stale".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Stale", "Stale", global::System.Management.Automation.CompletionResultType.ParameterValue, "Stale"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..8b9058baaca8 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for BlockchainMemberProvisioningState. + public partial class BlockchainMemberProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => BlockchainMemberProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs new file mode 100644 index 000000000000..ac5f927f69a6 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainMemberProvisioningState.cs @@ -0,0 +1,111 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct BlockchainMemberProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Stale = @"Stale"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState Updating = @"Updating"; + + /// + /// the value for an instance of the Enum. + /// + private string _value { get; set; } + + /// + /// Creates an instance of the + /// + /// the value to create an instance for. + private BlockchainMemberProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to BlockchainMemberProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new BlockchainMemberProvisioningState(System.Convert.ToString(value)); + } + + /// Compares values of enum type BlockchainMemberProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e) + { + return _value.Equals(e._value); + } + + /// + /// Compares values of enum type BlockchainMemberProvisioningState (override for Object) + /// + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is BlockchainMemberProvisioningState && Equals((BlockchainMemberProvisioningState)obj); + } + + /// Returns hashCode for enum BlockchainMemberProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for BlockchainMemberProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to BlockchainMemberProvisioningState + /// the value to convert to an instance of . + + public static implicit operator BlockchainMemberProvisioningState(string value) + { + return new BlockchainMemberProvisioningState(value); + } + + /// Implicit operator to convert BlockchainMemberProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum BlockchainMemberProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum BlockchainMemberProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainMemberProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs new file mode 100644 index 000000000000..bc7757d35ca4 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.Completer.cs @@ -0,0 +1,47 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for BlockchainProtocol. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocolTypeConverter))] + public partial struct BlockchainProtocol : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Parity".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Parity", "Parity", global::System.Management.Automation.CompletionResultType.ParameterValue, "Parity"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Quorum".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Quorum", "Quorum", global::System.Management.Automation.CompletionResultType.ParameterValue, "Quorum"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Corda".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Corda", "Corda", global::System.Management.Automation.CompletionResultType.ParameterValue, "Corda"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs new file mode 100644 index 000000000000..1a1d47940058 --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for BlockchainProtocol. + public partial class BlockchainProtocolTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => BlockchainProtocol.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/BlockchainProtocol.cs b/src/Blockchain/generated/api/Support/BlockchainProtocol.cs new file mode 100644 index 000000000000..5beaee1c1a1b --- /dev/null +++ b/src/Blockchain/generated/api/Support/BlockchainProtocol.cs @@ -0,0 +1,101 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct BlockchainProtocol : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Corda = @"Corda"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Parity = @"Parity"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Quorum = @"Quorum"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Creates an instance of the + /// the value to create an instance for. + private BlockchainProtocol(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Conversion from arbitrary object to BlockchainProtocol + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new BlockchainProtocol(System.Convert.ToString(value)); + } + + /// Compares values of enum type BlockchainProtocol + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type BlockchainProtocol (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is BlockchainProtocol && Equals((BlockchainProtocol)obj); + } + + /// Returns hashCode for enum BlockchainProtocol + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Returns string representation for BlockchainProtocol + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to BlockchainProtocol + /// the value to convert to an instance of . + + public static implicit operator BlockchainProtocol(string value) + { + return new BlockchainProtocol(value); + } + + /// Implicit operator to convert BlockchainProtocol to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e) + { + return e._value; + } + + /// Overriding != operator for enum BlockchainProtocol + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum BlockchainProtocol + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs new file mode 100644 index 000000000000..af9e17fc4f14 --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.Completer.cs @@ -0,0 +1,43 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for NameAvailabilityReason. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReasonTypeConverter))] + public partial struct NameAvailabilityReason : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "AlreadyExists".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("AlreadyExists", "AlreadyExists", global::System.Management.Automation.CompletionResultType.ParameterValue, "AlreadyExists"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Invalid".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Invalid", "Invalid", global::System.Management.Automation.CompletionResultType.ParameterValue, "Invalid"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs new file mode 100644 index 000000000000..6d809191322d --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for NameAvailabilityReason. + public partial class NameAvailabilityReasonTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NameAvailabilityReason.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs b/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs new file mode 100644 index 000000000000..a9a2ac91323b --- /dev/null +++ b/src/Blockchain/generated/api/Support/NameAvailabilityReason.cs @@ -0,0 +1,99 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct NameAvailabilityReason : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason AlreadyExists = @"AlreadyExists"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason Invalid = @"Invalid"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason NotSpecified = @"NotSpecified"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to NameAvailabilityReason + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new NameAvailabilityReason(System.Convert.ToString(value)); + } + + /// Compares values of enum type NameAvailabilityReason + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type NameAvailabilityReason (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is NameAvailabilityReason && Equals((NameAvailabilityReason)obj); + } + + /// Returns hashCode for enum NameAvailabilityReason + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private NameAvailabilityReason(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for NameAvailabilityReason + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to NameAvailabilityReason + /// the value to convert to an instance of . + + public static implicit operator NameAvailabilityReason(string value) + { + return new NameAvailabilityReason(value); + } + + /// Implicit operator to convert NameAvailabilityReason to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e) + { + return e._value; + } + + /// Overriding != operator for enum NameAvailabilityReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum NameAvailabilityReason + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NameAvailabilityReason e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs new file mode 100644 index 000000000000..59b52b9af1c0 --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.Completer.cs @@ -0,0 +1,51 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// Argument completer implementation for NodeProvisioningState. + [System.ComponentModel.TypeConverter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningStateTypeConverter))] + public partial struct NodeProvisioningState : + System.Management.Automation.IArgumentCompleter + { + + /// + /// Implementations of this function are called by PowerShell to complete arguments. + /// + /// The name of the command that needs argument completion. + /// The name of the parameter that needs argument completion. + /// The (possibly empty) word being completed. + /// The command ast in case it is needed for completion. + /// This parameter is similar to $PSBoundParameters, except that sometimes PowerShell cannot + /// or will not attempt to evaluate an argument, in which case you may need to use commandAst. + /// + /// A collection of completion results, most like with ResultType set to ParameterValue. + /// + public global::System.Collections.Generic.IEnumerable CompleteArgument(global::System.String commandName, global::System.String parameterName, global::System.String wordToComplete, global::System.Management.Automation.Language.CommandAst commandAst, global::System.Collections.IDictionary fakeBoundParameters) + { + if (global::System.String.IsNullOrEmpty(wordToComplete) || "NotSpecified".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("NotSpecified", "NotSpecified", global::System.Management.Automation.CompletionResultType.ParameterValue, "NotSpecified"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Updating".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Updating", "Updating", global::System.Management.Automation.CompletionResultType.ParameterValue, "Updating"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Deleting".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Deleting", "Deleting", global::System.Management.Automation.CompletionResultType.ParameterValue, "Deleting"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Succeeded".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Succeeded", "Succeeded", global::System.Management.Automation.CompletionResultType.ParameterValue, "Succeeded"); + } + if (global::System.String.IsNullOrEmpty(wordToComplete) || "Failed".StartsWith(wordToComplete, global::System.StringComparison.InvariantCultureIgnoreCase)) + { + yield return new global::System.Management.Automation.CompletionResult("Failed", "Failed", global::System.Management.Automation.CompletionResultType.ParameterValue, "Failed"); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs new file mode 100644 index 000000000000..34843d8be9aa --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.TypeConverter.cs @@ -0,0 +1,59 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + /// TypeConverter implementation for NodeProvisioningState. + public partial class NodeProvisioningStateTypeConverter : + global::System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => true; + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => NodeProvisioningState.CreateFrom(sourceValue); + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/api/Support/NodeProvisioningState.cs b/src/Blockchain/generated/api/Support/NodeProvisioningState.cs new file mode 100644 index 000000000000..f05019dcf44d --- /dev/null +++ b/src/Blockchain/generated/api/Support/NodeProvisioningState.cs @@ -0,0 +1,103 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support +{ + + public partial struct NodeProvisioningState : + System.IEquatable + { + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Deleting = @"Deleting"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Failed = @"Failed"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState NotSpecified = @"NotSpecified"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Succeeded = @"Succeeded"; + + public static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState Updating = @"Updating"; + + /// the value for an instance of the Enum. + private string _value { get; set; } + + /// Conversion from arbitrary object to NodeProvisioningState + /// the value to convert to an instance of . + internal static object CreateFrom(object value) + { + return new NodeProvisioningState(System.Convert.ToString(value)); + } + + /// Compares values of enum type NodeProvisioningState + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public bool Equals(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e) + { + return _value.Equals(e._value); + } + + /// Compares values of enum type NodeProvisioningState (override for Object) + /// the value to compare against this instance. + /// true if the two instances are equal to the same value + public override bool Equals(object obj) + { + return obj is NodeProvisioningState && Equals((NodeProvisioningState)obj); + } + + /// Returns hashCode for enum NodeProvisioningState + /// The hashCode of the value + public override int GetHashCode() + { + return this._value.GetHashCode(); + } + + /// Creates an instance of the + /// the value to create an instance for. + private NodeProvisioningState(string underlyingValue) + { + this._value = underlyingValue; + } + + /// Returns string representation for NodeProvisioningState + /// A string for this value. + public override string ToString() + { + return this._value; + } + + /// Implicit operator to convert string to NodeProvisioningState + /// the value to convert to an instance of . + + public static implicit operator NodeProvisioningState(string value) + { + return new NodeProvisioningState(value); + } + + /// Implicit operator to convert NodeProvisioningState to string + /// the value to convert to an instance of . + + public static implicit operator string(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e) + { + return e._value; + } + + /// Overriding != operator for enum NodeProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are not equal to the same value + public static bool operator !=(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// Overriding == operator for enum NodeProvisioningState + /// the value to compare against + /// the value to compare against + /// true if the two instances are equal to the same value + public static bool operator ==(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e1, Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.NodeProvisioningState e2) + { + return e2.Equals(e1); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs new file mode 100644 index 000000000000..f52ab75e9cb1 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainConsortium_List.cs @@ -0,0 +1,337 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the available consortiums for a subscription. + /// + /// [OpenAPI] Locations_ListConsortiums=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/listConsortiums" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainConsortium_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the available consortiums for a subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainConsortium_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// Location Name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Location Name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainConsortium_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LocationsListConsortiums' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsListConsortiums(Location, SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Location=Location,SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs new file mode 100644 index 000000000000..2669d488a1ab --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberApiKey_List.cs @@ -0,0 +1,354 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_ListApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/listApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMemberApiKey_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMemberApiKey_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMemberApiKey_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersListApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListApiKeys(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs new file mode 100644 index 000000000000..b61896db922b --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMemberConsortiumMember_List.cs @@ -0,0 +1,361 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the consortium members for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_ListConsortiumMembers=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/consortiumMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMemberConsortiumMember_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the consortium members for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMemberConsortiumMember_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMemberConsortiumMember_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListConsortiumMembers(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListConsortiumMembers_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs new file mode 100644 index 000000000000..1a6eb4dd4dfa --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_Get.cs @@ -0,0 +1,351 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get details about a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get details about a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersGet(Name, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs new file mode 100644 index 000000000000..f097feaff504 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_GetViaIdentity.cs @@ -0,0 +1,323 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get details about a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get details about a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersGet(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs new file mode 100644 index 000000000000..360e61e88944 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List.cs @@ -0,0 +1,347 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the blockchain members for a resource group. + /// + /// [OpenAPI] BlockchainMembers_List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the blockchain members for a resource group.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersList(SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs new file mode 100644 index 000000000000..a3aadf7de6a8 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainMember_List1.cs @@ -0,0 +1,330 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the blockchain members for a subscription. + /// + /// [OpenAPI] BlockchainMembers_ListAll=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainMember_List1")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the blockchain members for a subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainMember_List1 : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainMember_List1() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListAll(SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersListAll_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs new file mode 100644 index 000000000000..fd98e3a474bd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainOperation_List.cs @@ -0,0 +1,307 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the available operations of Microsoft.Blockchain resource provider. + /// + /// [OpenAPI] Operations_List=>GET:"/providers/Microsoft.Blockchain/operations" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainOperation_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the available operations of Microsoft.Blockchain resource provider.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainOperation_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainOperation_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList(onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.OperationsList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs new file mode 100644 index 000000000000..32ba093777ea --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainSku_List.cs @@ -0,0 +1,320 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the Skus of the resource type. + /// + /// [OpenAPI] Skus_List=>GET:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainSku_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the Skus of the resource type.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainSku_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainSku_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.SkusList(SubscriptionId, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / value / + WriteObject((await response).Value, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs new file mode 100644 index 000000000000..18092a0acd65 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNodeApiKey_List.cs @@ -0,0 +1,368 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// List the API keys for the transaction node. + /// + /// [OpenAPI] TransactionNodes_ListApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNodeApiKey_List", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"List the API keys for the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNodeApiKey_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNodeApiKey_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesListApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesListApiKeys(BlockchainMemberName, TransactionNodeName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,TransactionNodeName=TransactionNodeName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs new file mode 100644 index 000000000000..84a04153f283 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_Get.cs @@ -0,0 +1,365 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get the details of the transaction node. + /// + /// [OpenAPI] TransactionNodes_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_Get")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get the details of the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_Get : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_Get() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesGet(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs new file mode 100644 index 000000000000..67a067068323 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_GetViaIdentity.cs @@ -0,0 +1,327 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Get the details of the transaction node. + /// + /// [OpenAPI] TransactionNodes_Get=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_GetViaIdentity")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Get the details of the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_GetViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_GetViaIdentity() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesGetViaIdentity(InputObject.Id, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesGet(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs new file mode 100644 index 000000000000..b6dd542170bf --- /dev/null +++ b/src/Blockchain/generated/cmdlets/GetAzBlockchainTransactionNode_List.cs @@ -0,0 +1,361 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Lists the transaction nodes for a blockchain member. + /// + /// [OpenAPI] TransactionNodes_List=>GET:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Get, @"AzBlockchainTransactionNode_List")] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Lists the transaction nodes for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class GetAzBlockchainTransactionNode_List : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string[] _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string[] SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public GetAzBlockchainTransactionNode_List() + { + + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + foreach( var SubscriptionId in this.SubscriptionId ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesList(BlockchainMemberName, SubscriptionId, ResourceGroupName, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // pageable / value / nextLink + var result = await response; + WriteObject(result.Value,true); + if (result.NextLink != null) + { + if (responseMessage.RequestMessage is System.Net.Http.HttpRequestMessage requestMessage ) + { + requestMessage = requestMessage.Clone(new global::System.Uri( result.NextLink ),Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Method.Get ); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.FollowingNextLink); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesList_Call(requestMessage, onOk, this, Pipeline); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs new file mode 100644 index 000000000000..b745fa2db13b --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateExpanded.cs @@ -0,0 +1,381 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMemberApiKey_RegenerateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMemberApiKey_RegenerateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMemberApiKey_RegenerateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersRegenerateApiKeys(BlockchainMemberName, SubscriptionId, ResourceGroupName, ApiKeyBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs new file mode 100644 index 000000000000..0eff45f441a2 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded.cs @@ -0,0 +1,357 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMemberApiKey_RegenerateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMemberApiKey_RegenerateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersRegenerateApiKeysViaIdentity(InputObject.Id, ApiKeyBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersRegenerateApiKeys(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, ApiKeyBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs new file mode 100644 index 000000000000..cc332329d651 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainMember_CreateExpanded.cs @@ -0,0 +1,564 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Create a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainMember_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Create a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainMember_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMember(); + + /// + /// Payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Gets or sets the consortium for the blockchain member. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the consortium for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the consortium for the blockchain member.", + SerializedName = @"consortium", + PossibleTypes = new [] { typeof(string) })] + public string Consortium { get => BlockchainMemberBody.Consortium ?? null; set => BlockchainMemberBody.Consortium = value; } + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// Gets the display name of the member in the consortium. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the display name of the member in the consortium.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the display name of the member in the consortium.", + SerializedName = @"consortiumMemberDisplayName", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumMemberDisplayName { get => BlockchainMemberBody.ConsortiumMemberDisplayName ?? null; set => BlockchainMemberBody.ConsortiumMemberDisplayName = value; } + + /// Gets the role of the member in the consortium. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets the role of the member in the consortium.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets the role of the member in the consortium.", + SerializedName = @"consortiumRole", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumRole { get => BlockchainMemberBody.ConsortiumRole ?? null; set => BlockchainMemberBody.ConsortiumRole = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets firewall rules + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets firewall rules")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets firewall rules", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// The GEO location of the blockchain service. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The GEO location of the blockchain service.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"The GEO location of the blockchain service.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => BlockchainMemberBody.Location ?? null; set => BlockchainMemberBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Sets the basic auth password of the blockchain member. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the basic auth password of the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the basic auth password of the blockchain member.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// Gets or sets the blockchain protocol. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the blockchain protocol.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the blockchain protocol.", + SerializedName = @"protocol", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol) })] + [global::System.Management.Automation.ArgumentCompleter(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol))] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol Protocol { get => BlockchainMemberBody.Protocol ?? ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol)""); set => BlockchainMemberBody.Protocol = value; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Gets or sets Sku name + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets Sku name")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku name", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string SkuName { get => BlockchainMemberBody.SkuName ?? null; set => BlockchainMemberBody.SkuName = value; } + + /// Gets or sets Sku tier + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets Sku tier")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets Sku tier", + SerializedName = @"tier", + PossibleTypes = new [] { typeof(string) })] + public string SkuTier { get => BlockchainMemberBody.SkuTier ?? null; set => BlockchainMemberBody.SkuTier = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// Gets or sets the nodes capacity. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the nodes capacity.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the nodes capacity.", + SerializedName = @"capacity", + PossibleTypes = new [] { typeof(int) })] + public int ValidatorNodeSkuCapacity { get => BlockchainMemberBody.ValidatorNodeSkuCapacity ?? default(int); set => BlockchainMemberBody.ValidatorNodeSkuCapacity = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzBlockchainMember_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.NewAzBlockchainMember_CreateExpanded Clone() + { + var clone = new NewAzBlockchainMember_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.BlockchainMemberBody = this.BlockchainMemberBody; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainMember_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersCreate(Name, SubscriptionId, ResourceGroupName, BlockchainMemberBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs new file mode 100644 index 000000000000..929c4cb22391 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded.cs @@ -0,0 +1,395 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for the blockchain member. + /// + /// [OpenAPI] TransactionNodes_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNodeApiKey_RegenerateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private string _transactionNodeName; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string TransactionNodeName { get => this._transactionNodeName; set => this._transactionNodeName = value; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainTransactionNodeApiKey_RegenerateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesRegenerateApiKeys(BlockchainMemberName, TransactionNodeName, SubscriptionId, ResourceGroupName, ApiKeyBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,TransactionNodeName=TransactionNodeName,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs new file mode 100644 index 000000000000..c1673eb6a110 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded.cs @@ -0,0 +1,362 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Regenerate the API keys for the blockchain member. + /// + /// [OpenAPI] TransactionNodes_RegenerateApiKeys=>POST:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Regenerate the API keys for the blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey _apiKeyBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ApiKey(); + + /// + /// API key payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey ApiKeyBody { get => this._apiKeyBody; set => this._apiKeyBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the API key name. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key name.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key name.", + SerializedName = @"keyName", + PossibleTypes = new [] { typeof(string) })] + public string KeyName { get => ApiKeyBody.KeyName ?? null; set => ApiKeyBody.KeyName = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Gets or sets the API key value. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the API key value.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the API key value.", + SerializedName = @"value", + PossibleTypes = new [] { typeof(string) })] + public string Value { get => ApiKeyBody.Value ?? null; set => ApiKeyBody.Value = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet + /// class. + /// + public NewAzBlockchainTransactionNodeApiKey_RegenerateViaIdentityExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesRegenerateApiKeys' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesRegenerateApiKeysViaIdentity(InputObject.Id, ApiKeyBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesRegenerateApiKeys(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, ApiKeyBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=ApiKeyBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // response should be returning an array of some kind. +Pageable + // nested-array / keys / + WriteObject((await response).Key, true); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs new file mode 100644 index 000000000000..3284d784a0dd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/NewAzBlockchainTransactionNode_CreateExpanded.cs @@ -0,0 +1,476 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Create or update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Create=>PUT:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.New, @"AzBlockchainTransactionNode_CreateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Create or update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class NewAzBlockchainTransactionNode_CreateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Gets or sets the transaction node location. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the transaction node location.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the transaction node location.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + public string Location { get => TransactionNodeBody.Location ?? null; set => TransactionNodeBody.Location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNode(); + + /// + /// Payload of the transaction node which is the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of NewAzBlockchainTransactionNode_CreateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.NewAzBlockchainTransactionNode_CreateExpanded Clone() + { + var clone = new NewAzBlockchainTransactionNode_CreateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.TransactionNodeBody = this.TransactionNodeBody; + clone.BlockchainMemberName = this.BlockchainMemberName; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public NewAzBlockchainTransactionNode_CreateExpanded() + { + + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesCreate' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesCreate(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, TransactionNodeBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs new file mode 100644 index 000000000000..8dc7609c7611 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_Delete.cs @@ -0,0 +1,422 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainMember_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainMember_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainMember_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainMember_Delete Clone() + { + var clone = new RemoveAzBlockchainMember_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersDelete(Name, SubscriptionId, ResourceGroupName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainMember_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs new file mode 100644 index 000000000000..4c1ebbf70d4d --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainMember_DeleteViaIdentity.cs @@ -0,0 +1,394 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainMember_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainMember_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainMember_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainMember_DeleteViaIdentity Clone() + { + var clone = new RemoveAzBlockchainMember_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersDelete(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainMember_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs new file mode 100644 index 000000000000..35cf177f7ecd --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_Delete.cs @@ -0,0 +1,437 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete the transaction node. + /// + /// [OpenAPI] TransactionNodes_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainTransactionNode_Delete", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainTransactionNode_Delete : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainTransactionNode_Delete + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainTransactionNode_Delete Clone() + { + var clone = new RemoveAzBlockchainTransactionNode_Delete(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone.BlockchainMemberName = this.BlockchainMemberName; + clone.Name = this.Name; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesDelete(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, onNoContent, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainTransactionNode_Delete() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs new file mode 100644 index 000000000000..86785eda5812 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/RemoveAzBlockchainTransactionNode_DeleteViaIdentity.cs @@ -0,0 +1,398 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Delete the transaction node. + /// + /// [OpenAPI] TransactionNodes_Delete=>DELETE:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsCommon.Remove, @"AzBlockchainTransactionNode_DeleteViaIdentity", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(bool))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Delete the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class RemoveAzBlockchainTransactionNode_DeleteViaIdentity : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + + /// + /// When specified, forces the cmdlet return a 'bool' given that there isn't a return type by default. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Returns true when the command succeeds")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter PassThru { get; set; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// overrideOnNoContent will be called before the regular onNoContent has been processed, allowing customization of + /// what happens on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// /// Determines if the rest of the onNoContent method should be processed, or if the method should + /// return immediately (set to true to skip further processing ) + + partial void overrideOnNoContent(global::System.Net.Http.HttpResponseMessage responseMessage, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of RemoveAzBlockchainTransactionNode_DeleteViaIdentity + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets.RemoveAzBlockchainTransactionNode_DeleteViaIdentity Clone() + { + var clone = new RemoveAzBlockchainTransactionNode_DeleteViaIdentity(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + return clone; + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.DelayBeforePolling: + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + var data = messageData(); + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + break; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesDelete' operation")) + { + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) + { + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesDeleteViaIdentity(InputObject.Id, onNoContent, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesDelete(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, onNoContent, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public RemoveAzBlockchainTransactionNode_DeleteViaIdentity() + { + + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// a delegate that is called when the remote service returns 204 (NoContent). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onNoContent(global::System.Net.Http.HttpResponseMessage responseMessage) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnNoContent(responseMessage, ref _returnNow); + // if overrideOnNoContent has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onNoContent - response for 204 / + if (true == MyInvocation?.BoundParameters?.ContainsKey("PassThru")) + { + WriteObject(true); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs b/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs new file mode 100644 index 000000000000..614be8513e43 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/TestAzBlockchainLocationNameAvailability_CheckExpanded.cs @@ -0,0 +1,363 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// To check whether a resource name is available. + /// + /// [OpenAPI] Locations_CheckNameAvailability=>POST:"/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{location}/checkNameAvailability" + /// + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsDiagnostic.Test, @"AzBlockchainLocationNameAvailability_CheckExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"To check whether a resource name is available.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class TestAzBlockchainLocationNameAvailability_CheckExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// Backing field for property. + private string _location; + + /// Location Name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Location Name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Location Name.", + SerializedName = @"location", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Location { get => this._location; set => this._location = value; } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Gets or sets the name to check. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the name to check.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the name to check.", + SerializedName = @"name", + PossibleTypes = new [] { typeof(string) })] + public string Name { get => NameAvailabilityRequestBody.Name ?? null; set => NameAvailabilityRequestBody.Name = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest _nameAvailabilityRequestBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.NameAvailabilityRequest(); + + /// + /// Name availability request payload which is exposed in the request of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailabilityRequest NameAvailabilityRequestBody { get => this._nameAvailabilityRequestBody; set => this._nameAvailabilityRequestBody = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Gets or sets the type of the resource to check. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the type of the resource to check.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the type of the resource to check.", + SerializedName = @"type", + PossibleTypes = new [] { typeof(string) })] + public string Type { get => NameAvailabilityRequestBody.Type ?? null; set => NameAvailabilityRequestBody.Type = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'LocationsCheckNameAvailability' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.LocationsCheckNameAvailability(Location, SubscriptionId, NameAvailabilityRequestBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Location=Location,SubscriptionId=SubscriptionId,body=NameAvailabilityRequestBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public TestAzBlockchainLocationNameAvailability_CheckExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs new file mode 100644 index 000000000000..3b0df63debc2 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateExpanded.cs @@ -0,0 +1,408 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainMember_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainMember_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdate(); + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("BlockchainMemberName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.BlockchainMembersUpdate(Name, SubscriptionId, ResourceGroupName, BlockchainMemberBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainMember_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..67595a9ddb52 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainMember_UpdateViaIdentityExpanded.cs @@ -0,0 +1,383 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update a blockchain member. + /// + /// [OpenAPI] BlockchainMembers_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainMember_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update a blockchain member.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainMember_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate _blockchainMemberBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.BlockchainMemberUpdate(); + + /// + /// Update the payload of the blockchain member which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdate BlockchainMemberBody { get => this._blockchainMemberBody; set => this._blockchainMemberBody = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// Sets the managed consortium management account password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the managed consortium management account password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the managed consortium management account password.", + SerializedName = @"consortiumManagementAccountPassword", + PossibleTypes = new [] { typeof(string) })] + public string ConsortiumManagementAccountPassword { get => BlockchainMemberBody.ConsortiumManagementAccountPassword ?? null; set => BlockchainMemberBody.ConsortiumManagementAccountPassword = value; } + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => BlockchainMemberBody.FirewallRule ?? null /* arrayOf */; set => BlockchainMemberBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => BlockchainMemberBody.Password ?? null; set => BlockchainMemberBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// + /// Tags of the service which is a list of key value pairs that describes the resource. + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ExportAs(typeof(global::System.Collections.Hashtable))] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Tags of the service which is a list of key value pairs that describes the resource.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Tags of the service which is a list of key value pairs that describes the resource.", + SerializedName = @"tags", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags Tag { get => BlockchainMemberBody.Tag ?? null /* object */; set => BlockchainMemberBody.Tag = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'BlockchainMembersUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.BlockchainMembersUpdateViaIdentity(InputObject.Id, BlockchainMemberBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.BlockchainMembersUpdate(InputObject.BlockchainMemberName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, BlockchainMemberBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=BlockchainMemberBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainMember_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs new file mode 100644 index 000000000000..6835daad7e4a --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateExpanded.cs @@ -0,0 +1,397 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainTransactionNode_UpdateExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainTransactionNode_UpdateExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Backing field for property. + private string _blockchainMemberName; + + /// Blockchain member name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Blockchain member name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Blockchain member name.", + SerializedName = @"blockchainMemberName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string BlockchainMemberName { get => this._blockchainMemberName; set => this._blockchainMemberName = value; } + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Backing field for property. + private string _name; + + /// Transaction node name. + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Transaction node name.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Transaction node name.", + SerializedName = @"transactionNodeName", + PossibleTypes = new [] { typeof(string) })] + [global::System.Management.Automation.Alias("TransactionNodeName")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string Name { get => this._name; set => this._name = value; } + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private string _resourceGroupName; + + /// + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API + /// or the portal. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.", + SerializedName = @"resourceGroupName", + PossibleTypes = new [] { typeof(string) })] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } + + /// Backing field for property. + private string _subscriptionId; + + /// + /// Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the + /// URI for every service call. + /// + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.")] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = true, + ReadOnly = false, + Description = @"Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call.", + SerializedName = @"subscriptionId", + PossibleTypes = new [] { typeof(string) })] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo( + Name = @"", + Description =@"", + Script = @"(Get-AzContext).Subscription.Id")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeUpdate(); + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await this.Client.TransactionNodesUpdate(BlockchainMemberName, Name, SubscriptionId, ResourceGroupName, TransactionNodeBody, onOk, this, Pipeline); + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { BlockchainMemberName=BlockchainMemberName,Name=Name,SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainTransactionNode_UpdateExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs new file mode 100644 index 000000000000..bfa7e68d8b72 --- /dev/null +++ b/src/Blockchain/generated/cmdlets/UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded.cs @@ -0,0 +1,362 @@ +// 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. + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Cmdlets +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + /// Update the transaction node. + /// + /// [OpenAPI] TransactionNodes_Update=>PATCH:"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}" + /// + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.InternalExport] + [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzBlockchainTransactionNode_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] + [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode))] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Description(@"Update the transaction node.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Generated] + public partial class UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener + { + /// A unique id generatd for the this cmdlet when it is instantiated. + private string __correlationId = System.Guid.NewGuid().ToString(); + + /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) + private global::System.Management.Automation.InvocationInfo __invocationInfo; + + /// A unique id generatd for the this cmdlet when ProcessRecord() is called. + private string __processRecordId; + + /// + /// The for this operation. + /// + private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); + + /// Wait for .NET debugger to attach + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter Break { get; set; } + + /// The reference to the client API class. + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Blockchain Client => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.ClientAPI; + + /// + /// The credentials, account, tenant, and subscription used for communication with Azure + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The credentials, account, tenant, and subscription used for communication with Azure.")] + [global::System.Management.Automation.ValidateNotNull] + [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Azure)] + public global::System.Management.Automation.PSObject DefaultProfile { get; set; } + + /// Gets or sets the firewall rules. + [global::System.Management.Automation.AllowEmptyCollection] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Gets or sets the firewall rules.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Gets or sets the firewall rules.", + SerializedName = @"firewallRules", + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule) })] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] FirewallRule { get => TransactionNodeBody.FirewallRule ?? null /* arrayOf */; set => TransactionNodeBody.FirewallRule = value; } + + /// SendAsync Pipeline Steps to be appended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } + + /// SendAsync Pipeline Steps to be prepended to the front of the pipeline + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity _inputObject; + + /// Identity Parameter + [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Identity Parameter", ValueFromPipeline = true)] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Path)] + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity InputObject { get => this._inputObject; set => this._inputObject = value; } + + /// Accessor for our copy of the InvocationInfo. + public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } + + /// + /// cancellation delegate. Stops the cmdlet when called. + /// + global::System.Action Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; + + /// cancellation token. + global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Token => _cancellationTokenSource.Token; + + /// Sets the transaction node dns endpoint basic auth password. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Sets the transaction node dns endpoint basic auth password.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Body)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info( + Required = false, + ReadOnly = false, + Description = @"Sets the transaction node dns endpoint basic auth password.", + SerializedName = @"password", + PossibleTypes = new [] { typeof(string) })] + public string Password { get => TransactionNodeBody.Password ?? null; set => TransactionNodeBody.Password = value; } + + /// + /// The instance of the that the remote call will use. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.HttpPipeline Pipeline { get; set; } + + /// The URI for the proxy server to use + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Uri Proxy { get; set; } + + /// Credentials for a proxy server to use for the remote call + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] + [global::System.Management.Automation.ValidateNotNull] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } + + /// Use the default credentials for the proxy + [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] + [global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category(global::Microsoft.Azure.PowerShell.Cmdlets.Blockchain.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } + + /// Backing field for property. + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate _transactionNodeBody= new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.TransactionNodeUpdate(); + + /// + /// Update the transaction node payload which is exposed in the request/response of the resource provider. + /// + private Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNodeUpdate TransactionNodeBody { get => this._transactionNodeBody; set => this._transactionNodeBody = value; } + + /// + /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens + /// on that response. Implement this method in a partial class to enable this behavior + /// + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// /// Determines if the rest of the onOk method should be processed, or if the method should return + /// immediately (set to true to skip further processing ) + + partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); + + /// + /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) + /// + protected override void BeginProcessing() + { + Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); + if (Break) + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.AttachDebugger.Break(); + } + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Performs clean-up after the command execution + protected override void EndProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletEndProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + + /// Handles/Dispatches events during the call to the REST service. + /// The message id + /// The message cancellation token. When this call is cancelled, this should be true + /// Detailed message data for the message event. + /// + /// A that will be complete when handling of the message is completed. + /// + async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) + { + using( NoSynchronizationContext ) + { + if (token.IsCancellationRequested) + { + return ; + } + + switch ( id ) + { + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Verbose: + { + WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Warning: + { + WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Information: + { + var data = messageData(); + WriteInformation(data, new[] { data.Message }); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Debug: + { + WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); + return ; + } + case Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.Error: + { + WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); + return ; + } + } + await Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.Signal(id, token, messageData, (i,t,m) => ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(i,t,()=> Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventDataConverter.ConvertFrom( m() ) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.EventData ), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); + if (token.IsCancellationRequested) + { + return ; + } + WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); + } + } + + /// Performs execution of the command. + protected override void ProcessRecord() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + __processRecordId = System.Guid.NewGuid().ToString(); + try + { + // work + if (ShouldProcess($"Call remote 'TransactionNodesUpdate' operation")) + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token); + } + } + } + catch (global::System.AggregateException aggregateException) + { + // unroll the inner exceptions to get the root cause + foreach( var innerException in aggregateException.Flatten().InnerExceptions ) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + } + catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + // Write exception out to error channel. + WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); + } + finally + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordEnd).Wait(); + } + } + + /// Performs execution of the command, working asynchronously if required. + /// + /// A that will be complete when handling of the method is completed. + /// + protected async global::System.Threading.Tasks.Task ProcessRecordAsync() + { + using( NoSynchronizationContext ) + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncStart); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + Pipeline = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName); + if (null != HttpPipelinePrepend) + { + Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); + } + if (null != HttpPipelineAppend) + { + Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); + } + // get the client instance + try + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + if (InputObject?.Id != null) + { + await this.Client.TransactionNodesUpdateViaIdentity(InputObject.Id, TransactionNodeBody, onOk, this, Pipeline); + } + else + { + // try to call with PATH parameters from Input Object + if (null == InputObject.BlockchainMemberName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.BlockchainMemberName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.TransactionNodeName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.TransactionNodeName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.SubscriptionId) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.SubscriptionId"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + if (null == InputObject.ResourceGroupName) + { + ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceGroupName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); + } + await this.Client.TransactionNodesUpdate(InputObject.BlockchainMemberName ?? null, InputObject.TransactionNodeName ?? null, InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, TransactionNodeBody, onOk, this, Pipeline); + } + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } + } + catch (Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.UndeclaredResponseException urexception) + { + WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { body=TransactionNodeBody}) + { + ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } + }); + } + finally + { + await ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.CmdletProcessRecordAsyncEnd); + } + } + } + + /// Interrupts currently running code within the command. + protected override void StopProcessing() + { + ((Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener)this).Cancel(); + base.StopProcessing(); + } + + /// + /// Intializes a new instance of the cmdlet class. + /// + public UpdateAzBlockchainTransactionNode_UpdateViaIdentityExpanded() + { + + } + + /// a delegate that is called when the remote service returns 200 (OK). + /// the raw response message as an global::System.Net.Http.HttpResponseMessage. + /// the body result as a from the remote call + /// + /// A that will be complete when handling of the method is completed. + /// + private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) + { + using( NoSynchronizationContext ) + { + var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); + overrideOnOk(responseMessage, response, ref _returnNow); + // if overrideOnOk has returned true, then return right away. + if ((null != _returnNow && await _returnNow)) + { + return ; + } + // onOk - response for 200 / application/json + // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + WriteObject((await response)); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs b/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs new file mode 100644 index 000000000000..a56db88ef37c --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncCommandRuntime.cs @@ -0,0 +1,828 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + using System.Linq; + + internal interface IAsyncCommandRuntimeExtensions + { + Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep func); + System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs); + + T ExecuteSync(System.Func step); + } + + public class AsyncCommandRuntime : System.Management.Automation.ICommandRuntime2, IAsyncCommandRuntimeExtensions, System.IDisposable + { + private ICommandRuntime2 originalCommandRuntime; + private System.Threading.Thread originalThread; + public bool AllowInteractive { get; set; } = false; + + public CancellationToken cancellationToken; + SemaphoreSlim semaphore = new SemaphoreSlim(1, 1); + ManualResetEventSlim readyToRun = new ManualResetEventSlim(false); + ManualResetEventSlim completed = new ManualResetEventSlim(false); + + System.Action runOnMainThread; + + private System.Management.Automation.PSCmdlet cmdlet; + + internal AsyncCommandRuntime(System.Management.Automation.PSCmdlet cmdlet, CancellationToken cancellationToken) + { + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + this.cancellationToken = cancellationToken; + this.cmdlet = cmdlet; + cmdlet.CommandRuntime = this; + } + + public PSHost Host => this.originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => this.originalCommandRuntime.CurrentPSTransaction; + + private void CheckForInteractive() + { + // This is an interactive call -- if we are not on the original thread, this will only work if this was done at ACR creation time; + if (!AllowInteractive) + { + throw new System.Exception("AsyncCommandRuntime is not configured for interactive calls"); + } + } + private void WaitOurTurn() + { + // wait for our turn to play + semaphore?.Wait(cancellationToken); + + // ensure that completed is not set + completed.Reset(); + } + + private void WaitForCompletion() + { + // wait for the result (or cancellation!) + WaitHandle.WaitAny(new[] { cancellationToken.WaitHandle, completed?.WaitHandle }); + + // let go of the semaphore + semaphore?.Release(); + + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, hasSecurityImpact, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldContinue(query, caption, ref yesToAll, ref noToAll); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool yta = yesToAll; + bool nta = noToAll; + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldContinue(query, caption, ref yta, ref nta); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + yesToAll = yta; + noToAll = nta; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string target, string action) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(target, action); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(target, action); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out shouldProcessReason); + } + + CheckForInteractive(); + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + ShouldProcessReason reason = ShouldProcessReason.None; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.ShouldProcess(verboseDescription, verboseWarning, caption, out reason); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + shouldProcessReason = reason; + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.ThrowTerminatingError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.ThrowTerminatingError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public bool TransactionAvailable() + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return originalCommandRuntime.TransactionAvailable(); + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + bool result = false; + + // set the function to run + runOnMainThread = () => result = originalCommandRuntime.TransactionAvailable(); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // set the output variables + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteCommandDetail(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteCommandDetail(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteCommandDetail(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteDebug(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteDebug(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteDebug(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteError(ErrorRecord errorRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteError(errorRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteError(errorRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteInformation(informationRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteInformation(informationRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteObject(sendToPipeline, enumerateCollection); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteProgress(sourceId, progressRecord); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteProgress(sourceId, progressRecord); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteVerbose(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteVerbose(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteVerbose(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void WriteWarning(string text) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + originalCommandRuntime.WriteWarning(text); + return; + } + + // otherwise, queue up the request and wait for the main thread to do the right thing. + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + + // set the function to run + runOnMainThread = () => originalCommandRuntime.WriteWarning(text); + + // tell the main thread to go ahead + readyToRun.Set(); + + // wait for the result (or cancellation!) + WaitForCompletion(); + + // return + return; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Wait(System.Threading.Tasks.Task ProcessRecordAsyncTask, System.Threading.CancellationToken cancellationToken) + { + do + { + WaitHandle.WaitAny(new[] { readyToRun.WaitHandle, ((System.IAsyncResult)ProcessRecordAsyncTask).AsyncWaitHandle }); + if (readyToRun.IsSet) + { + // reset the request for the next time + readyToRun.Reset(); + + // run the delegate on this thread + runOnMainThread(); + + // tell the originator everything is complete + completed.Set(); + } + } + while (!ProcessRecordAsyncTask.IsCompleted); + if (ProcessRecordAsyncTask.IsFaulted) + { + // don't unwrap a Aggregate Exception -- we'll lose the stack trace of the actual exception. + // if( ProcessRecordAsyncTask.Exception is System.AggregateException aggregate ) { + // throw aggregate.InnerException; + // } + throw ProcessRecordAsyncTask.Exception; + } + } + public Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep Wrap(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep func) => func.Target.GetType().Name != "Closure" ? func : (p1, p2, p3) => ExecuteSync>(() => func(p1, p2, p3)); + public System.Collections.Generic.IEnumerable Wrap(System.Collections.Generic.IEnumerable funcs) => funcs?.Select(Wrap); + + public T ExecuteSync(System.Func step) + { + // if we are on the original thread, just call straight thru. + if (this.originalThread == System.Threading.Thread.CurrentThread) + { + return step(); + } + + T result = default(T); + try + { + // wait for our turn to talk to the main thread + WaitOurTurn(); + // set the function to run + runOnMainThread = () => { result = step(); }; + // tell the main thread to go ahead + readyToRun.Set(); + // wait for the result (or cancellation!) + WaitForCompletion(); + // return + return result; + } + catch (System.OperationCanceledException exception) + { + // maybe don't even worry? + throw exception; + } + } + + public void Dispose() + { + if (cmdlet != null) + { + cmdlet.CommandRuntime = this.originalCommandRuntime; + cmdlet = null; + } + + semaphore?.Dispose(); + semaphore = null; + readyToRun?.Dispose(); + readyToRun = null; + completed?.Dispose(); + completed = null; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncJob.cs b/src/Blockchain/generated/runtime/AsyncJob.cs new file mode 100644 index 000000000000..9fac2484960e --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncJob.cs @@ -0,0 +1,270 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using System.Management.Automation; + using System.Management.Automation.Host; + using System.Threading; + + using System.Threading.Tasks; + + public class LongRunningJobCancelledException : System.Exception + { + public LongRunningJobCancelledException(string message) : base(message) + { + + } + } + + public class AsyncJob : Job, System.Management.Automation.ICommandRuntime2 + { + const int MaxRecords = 1000; + + private string _statusMessage = string.Empty; + + public override string StatusMessage => _statusMessage; + + public override bool HasMoreData => Output.Count > 0 || Progress.Count > 0 || Error.Count > 0 || Warning.Count > 0 || Verbose.Count > 0 || Debug.Count > 0; + + public override string Location => "localhost"; + + public PSHost Host => originalCommandRuntime.Host; + + public PSTransactionContext CurrentPSTransaction => originalCommandRuntime.CurrentPSTransaction; + + public override void StopJob() + { + Cancel(); + } + + private readonly PSCmdlet cmdlet; + private readonly ICommandRuntime2 originalCommandRuntime; + private readonly System.Threading.Thread originalThread; + + private void CheckForInteractive() + { + // This is an interactive call -- We should never allow interactivity in AsnycJob cmdlets. + throw new System.Exception("Cmdlets in AsyncJob; interactive calls are not permitted."); + } + private bool IsJobDone => CancellationToken.IsCancellationRequested || this.JobStateInfo.State == JobState.Failed || this.JobStateInfo.State == JobState.Stopped || this.JobStateInfo.State == JobState.Stopping || this.JobStateInfo.State == JobState.Completed; + + private readonly System.Action Cancel; + private readonly CancellationToken CancellationToken; + + internal AsyncJob(PSCmdlet cmdlet, string line, string name, CancellationToken cancellationToken, System.Action cancelMethod) : base(line, name) + { + SetJobState(JobState.NotStarted); + // know how to cancel/check for cancelation + this.CancellationToken = cancellationToken; + this.Cancel = cancelMethod; + + // we might need these. + this.originalCommandRuntime = cmdlet.CommandRuntime as ICommandRuntime2; + this.originalThread = System.Threading.Thread.CurrentThread; + + // the instance of the cmdlet we're going to run + this.cmdlet = cmdlet; + + // set the command runtime to the AsyncJob + cmdlet.CommandRuntime = this; + } + + /// + /// Monitors the task (which should be ProcessRecordAsync) to control + /// the lifetime of the job itself + /// + /// + public void Monitor(Task task) + { + SetJobState(JobState.Running); + task.ContinueWith(antecedent => + { + if (antecedent.IsCanceled) + { + // if the task was canceled, we're just going to call it completed. + SetJobState(JobState.Completed); + } + else if (antecedent.IsFaulted) + { + foreach (var innerException in antecedent.Exception.Flatten().InnerExceptions) + { + WriteError(new System.Management.Automation.ErrorRecord(innerException, string.Empty, System.Management.Automation.ErrorCategory.NotSpecified, null)); + } + + // a fault indicates an actual failure + SetJobState(JobState.Failed); + } + else + { + // otherwiser it's a completed state. + SetJobState(JobState.Completed); + } + }, CancellationToken); + } + + private void CheckForCancellation() + { + if (IsJobDone) + { + throw new LongRunningJobCancelledException("Long running job is canceled or stopping, continuation of the cmdlet is not permitted."); + } + } + + public void WriteInformation(InformationRecord informationRecord) + { + CheckForCancellation(); + + this.Information.Add(informationRecord); + } + + public bool ShouldContinue(string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public void WriteDebug(string text) + { + _statusMessage = text; + CheckForCancellation(); + + if (Debug.IsOpen && Debug.Count < MaxRecords) + { + Debug.Add(new DebugRecord(text)); + } + } + + public void WriteError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + + public void WriteObject(object sendToPipeline) + { + CheckForCancellation(); + + if (Output.IsOpen) + { + Output.Add(new PSObject(sendToPipeline)); + } + } + + public void WriteObject(object sendToPipeline, bool enumerateCollection) + { + CheckForCancellation(); + + if (enumerateCollection && sendToPipeline is System.Collections.IEnumerable enumerable) + { + foreach (var item in enumerable) + { + WriteObject(item); + } + } + else + { + WriteObject(sendToPipeline); + } + } + + public void WriteProgress(ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteProgress(long sourceId, ProgressRecord progressRecord) + { + CheckForCancellation(); + + if (Progress.IsOpen && Progress.Count < MaxRecords) + { + Progress.Add(progressRecord); + } + } + + public void WriteVerbose(string text) + { + CheckForCancellation(); + + if (Verbose.IsOpen && Verbose.Count < MaxRecords) + { + Verbose.Add(new VerboseRecord(text)); + } + } + + public void WriteWarning(string text) + { + CheckForCancellation(); + + if (Warning.IsOpen && Warning.Count < MaxRecords) + { + Warning.Add(new WarningRecord(text)); + } + } + + public void WriteCommandDetail(string text) + { + WriteVerbose(text); + } + + public bool ShouldProcess(string target) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string target, string action) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldProcess(string verboseDescription, string verboseWarning, string caption, out ShouldProcessReason shouldProcessReason) + { + CheckForInteractive(); + shouldProcessReason = ShouldProcessReason.None; + return false; + } + + public bool ShouldContinue(string query, string caption) + { + CheckForInteractive(); + return false; + } + + public bool ShouldContinue(string query, string caption, ref bool yesToAll, ref bool noToAll) + { + CheckForInteractive(); + return false; + } + + public bool TransactionAvailable() + { + // interactivity required? + return false; + } + + public void ThrowTerminatingError(ErrorRecord errorRecord) + { + if (Error.IsOpen) + { + Error.Add(errorRecord); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/AsyncOperationResponse.cs b/src/Blockchain/generated/runtime/AsyncOperationResponse.cs new file mode 100644 index 000000000000..313b3cd75178 --- /dev/null +++ b/src/Blockchain/generated/runtime/AsyncOperationResponse.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + [System.ComponentModel.TypeConverter(typeof(AsyncOperationResponseTypeConverter))] + public class AsyncOperationResponse + { + private string _target; + public string Target { get => _target; set => _target = value; } + public AsyncOperationResponse() + { + } + internal AsyncOperationResponse(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json) + { + // pull target + { Target = If(json?.PropertyT("target"), out var _v) ? (string)_v : (string)Target; } + } + public string ToJsonString() + { + return $"{{ \"target\" : \"{this.Target}\" }}"; + } + + public static AsyncOperationResponse FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode node) + { + return node is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject json ? new AsyncOperationResponse(json) : null; + } + + + /// + /// Creates a new instance of , deserializing the content from a json string. + /// + /// a string containing a JSON serialized instance of this model. + /// an instance of the model class. + public static AsyncOperationResponse FromJsonString(string jsonText) => FromJson(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(jsonText)); + + } + + public partial class AsyncOperationResponseTypeConverter : System.Management.Automation.PSTypeConverter + { + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false. + /// + public override bool CanConvertFrom(object sourceValue, global::System.Type destinationType) => CanConvertFrom(sourceValue); + + /// + /// Determines if the converter can convert the parameter to the + /// parameter. + /// + /// the instance to check if it can be converted to the type. + /// + /// true if the instance could be converted to a type, otherwise false + /// + public static bool CanConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return true; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + // we say yest to PSObjects + return true; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + // we say yest to Hashtables/dictionaries + return true; + } + try + { + if (null != sourceValue.ToJsonString()) + { + return true; + } + } + catch + { + // Not one of our objects + } + try + { + string text = sourceValue.ToString()?.Trim(); + return true == text?.StartsWith("{") && true == text?.EndsWith("}") && Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(text).Type == Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonType.Object; + } + catch + { + // Doesn't look like it can be treated as JSON + } + return false; + } + + /// + /// Determines if the parameter can be converted to the parameter + /// + /// the to convert from + /// the to convert to + /// + /// true if the converter can convert the parameter to the + /// parameter, otherwise false + /// + public override bool CanConvertTo(object sourceValue, global::System.Type destinationType) => false; + + /// + /// Converts the parameter to the parameter using and + /// + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// + /// an instance of , or null if there is no suitable conversion. + /// + public override object ConvertFrom(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Converts the parameter to the parameter using and + /// + /// the value to convert into an instance of . + /// + /// an instance of , or null if there is no suitable conversion. + /// + public static object ConvertFrom(dynamic sourceValue) + { + if (null == sourceValue) + { + return null; + } + global::System.Type type = sourceValue.GetType(); + if (typeof(AsyncOperationResponse).IsAssignableFrom(type)) + { + return sourceValue; + } + try + { + return AsyncOperationResponse.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); ; + } + catch + { + // Unable to use JSON pattern + } + + if (typeof(System.Management.Automation.PSObject).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as System.Management.Automation.PSObject).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + if (typeof(global::System.Collections.IDictionary).IsAssignableFrom(type)) + { + return new AsyncOperationResponse { Target = (sourceValue as global::System.Collections.IDictionary).GetValueForProperty("target", "", global::System.Convert.ToString) }; + } + return null; + } + + /// NotImplemented -- this will return null + /// the to convert from + /// the to convert to + /// not used by this TypeConverter. + /// when set to true, will ignore the case when converting. + /// will always return null. + public override object ConvertTo(object sourceValue, global::System.Type destinationType, global::System.IFormatProvider formatProvider, bool ignoreCase) => null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs new file mode 100644 index 000000000000..8d5a5547be8d --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportCmdletSurface.cs @@ -0,0 +1,113 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "CmdletSurface")] + [DoNotExport] + public class ExportCmdletSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CmdletFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool IncludeGeneralParameters { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = GetScriptCmdlets(this, CmdletFolder) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + foreach (var profileGroup in profileGroups) + { + var variantGroups = profileGroup.Variants + .GroupBy(v => new { v.CmdletName }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), String.Empty, profileGroup.ProfileName)); + var sb = UseExpandedFormat ? ExpandedFormat(variantGroups) : CondensedFormat(variantGroups); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, $"CmdletSurface-{profileGroup.ProfileName}.md"), sb.ToString()); + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private StringBuilder ExpandedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + foreach (var variantGroup in variantGroups.OrderBy(vg => vg.CmdletName)) + { + sb.Append($"### {variantGroup.CmdletName}{Environment.NewLine}"); + var parameterGroups = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private StringBuilder CondensedFormat(IEnumerable variantGroups) + { + var sb = new StringBuilder(); + var condensedGroups = variantGroups + .GroupBy(vg => vg.CmdletNoun) + .Select(vgg => ( + CmdletNoun: vgg.Key, + CmdletVerbs: vgg.Select(vg => vg.CmdletVerb).OrderBy(cv => cv).ToArray(), + ParameterGroups: vgg.SelectMany(vg => vg.ParameterGroups).DistinctBy(p => p.ParameterName).ToArray(), + OutputTypes: vgg.SelectMany(vg => vg.OutputTypes).Select(ot => ot.Type).DistinctBy(t => t.Name).Select(t => t.ToSyntaxTypeName()).ToArray())) + .OrderBy(vg => vg.CmdletNoun); + foreach (var condensedGroup in condensedGroups) + { + sb.Append($"### {condensedGroup.CmdletNoun} [{String.Join(", ", condensedGroup.CmdletVerbs)}] `{String.Join(", ", condensedGroup.OutputTypes)}`{Environment.NewLine}"); + var parameterGroups = condensedGroup.ParameterGroups + .Where(pg => !pg.DontShow && (IncludeGeneralParameters || (pg.OrderCategory != ParameterCategory.Azure && pg.OrderCategory != ParameterCategory.Runtime))); + foreach (var parameterGroup in parameterGroups) + { + sb.Append($" - {parameterGroup.ParameterName} `{parameterGroup.ParameterType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs new file mode 100644 index 000000000000..1e1e81211002 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportExampleStub.cs @@ -0,0 +1,74 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ExampleStub")] + [DoNotExport] + public class ExportExampleStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + + var exampleText = String.Join(String.Empty, DefaultExampleHelpInfos.Select(ehi => ehi.ToHelpExampleOutput())); + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var cmdletFilePaths = GetScriptCmdlets(exportDirectory).Select(fi => Path.Combine(outputFolder, $"{fi.Name}.md")).ToArray(); + var currentExamplesFilePaths = Directory.GetFiles(outputFolder).ToArray(); + // Remove examples of non-existing cmdlets + var removedCmdletFilePaths = currentExamplesFilePaths.Except(cmdletFilePaths); + foreach (var removedCmdletFilePath in removedCmdletFilePaths) + { + File.Delete(removedCmdletFilePath); + } + + // Only create example stubs if they don't exist + foreach (var cmdletFilePath in cmdletFilePaths.Except(currentExamplesFilePaths)) + { + File.WriteAllText(cmdletFilePath, exampleText); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs new file mode 100644 index 000000000000..e708b4f659f6 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportFormatPs1xml.cs @@ -0,0 +1,99 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "FormatPs1xml")] + [DoNotExport] + public class ExportFormatPs1xml : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string FilePath { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support"; + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + + protected override void ProcessRecord() + { + try + { + var viewModels = GetFilteredViewParameters().Select(CreateViewModel).ToList(); + var ps1xml = new Configuration + { + ViewDefinitions = new ViewDefinitions + { + Views = viewModels + } + }; + File.WriteAllText(FilePath, ps1xml.ToXmlString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static IEnumerable GetFilteredViewParameters() + { + //https://stackoverflow.com/a/79738/294804 + //https://stackoverflow.com/a/949285/294804 + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass + && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace)) + && !t.GetCustomAttributes().Any()); + return types.Select(t => new ViewParameters(t, t.GetProperties() + .Select(p => new PropertyFormat(p)) + .Where(pf => !pf.Property.GetCustomAttributes().Any() + && (!IsAzure || pf.Property.Name != "Id") + && (pf.FormatTable != null || (pf.Origin != PropertyOrigin.Inlined && pf.Property.PropertyType.IsPsSimple()))) + .OrderByDescending(pf => pf.Index.HasValue) + .ThenBy(pf => pf.Index) + .ThenByDescending(pf => pf.Origin.HasValue) + .ThenBy(pf => pf.Origin))).Where(vp => vp.Properties.Any()); + } + + private static View CreateViewModel(ViewParameters viewParameters) + { + var entries = viewParameters.Properties.Select(pf => + (TableColumnHeader: new TableColumnHeader { Label = pf.Label, Width = pf.Width }, + TableColumnItem: new TableColumnItem { PropertyName = pf.Property.Name })).ToArray(); + + return new View + { + Name = viewParameters.Type.FullName, + ViewSelectedBy = new ViewSelectedBy + { + TypeName = viewParameters.Type.FullName + }, + TableControl = new TableControl + { + TableHeaders = new TableHeaders + { + TableColumnHeaders = entries.Select(e => e.TableColumnHeader).ToList() + }, + TableRowEntries = new TableRowEntries + { + TableRowEntry = new TableRowEntry + { + TableColumnItems = new TableColumnItems + { + TableItems = entries.Select(e => e.TableColumnItem).ToList() + } + } + } + } + }; + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs new file mode 100644 index 000000000000..4b9fc4f118ee --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportHelpMarkdown.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownRenderer; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "HelpMarkdown")] + [DoNotExport] + public class ExportHelpMarkdown : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSModuleInfo ModuleInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] FunctionInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSObject[] HelpInfo { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + protected override void ProcessRecord() + { + try + { + var helpInfos = HelpInfo.Select(hi => hi.ToPsHelpInfo()); + var variantGroups = FunctionInfo.Select(fi => fi.BaseObject).Cast() + .Join(helpInfos, fi => fi.Name, phi => phi.CmdletName, (fi, phi) => fi.ToVariants(phi)) + .Select(va => new VariantGroup(ModuleInfo.Name, va.First().CmdletName, va, String.Empty)); + WriteMarkdowns(variantGroups, ModuleInfo.ToModuleInfo(), DocsFolder, ExamplesFolder); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs new file mode 100644 index 000000000000..62eec8d62fc8 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportModelSurface.cs @@ -0,0 +1,117 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ModelSurface")] + [DoNotExport] + public class ExportModelSurface : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public bool UseExpandedFormat { get; set; } + + private const string ModelNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models"; + private const string SupportNamespace = @"Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support"; + + protected override void ProcessRecord() + { + try + { + var types = Assembly.GetExecutingAssembly().GetExportedTypes() + .Where(t => t.IsClass && (t.Namespace.StartsWith(ModelNamespace) || t.Namespace.StartsWith(SupportNamespace))); + var typeInfos = types.Select(t => new ModelTypeInfo + { + Type = t, + TypeName = t.Name, + Properties = t.GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(p => !p.GetIndexParameters().Any()).OrderBy(p => p.Name).ToArray(), + NamespaceGroup = t.Namespace.Split('.').LastOrDefault().EmptyIfNull() + }).Where(mti => mti.Properties.Any()); + var sb = UseExpandedFormat ? ExpandedFormat(typeInfos) : CondensedFormat(typeInfos); + Directory.CreateDirectory(OutputFolder); + File.WriteAllText(Path.Combine(OutputFolder, "ModelSurface.md"), sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + + private static StringBuilder ExpandedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + foreach (var typeInfo in typeInfos.OrderBy(mti => mti.TypeName).ThenBy(mti => mti.NamespaceGroup)) + { + sb.Append($"### {typeInfo.TypeName} [{typeInfo.NamespaceGroup}]{Environment.NewLine}"); + foreach (var property in typeInfo.Properties) + { + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}`{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + private static StringBuilder CondensedFormat(IEnumerable typeInfos) + { + var sb = new StringBuilder(); + var typeGroups = typeInfos + .GroupBy(mti => mti.TypeName) + .Select(tig => ( + Types: tig.Select(mti => mti.Type).ToArray(), + TypeName: tig.Key, + Properties: tig.SelectMany(mti => mti.Properties).DistinctBy(p => p.Name).OrderBy(p => p.Name).ToArray(), + NamespaceGroups: tig.Select(mti => mti.NamespaceGroup).OrderBy(ng => ng).ToArray() + )) + .OrderBy(tg => tg.TypeName); + foreach (var typeGroup in typeGroups) + { + var aType = typeGroup.Types.Select(GetAssociativeType).FirstOrDefault(t => t != null); + var aText = aType != null ? $@" \<{aType.ToSyntaxTypeName()}\>" : String.Empty; + sb.Append($"### {typeGroup.TypeName}{aText} [{String.Join(", ", typeGroup.NamespaceGroups)}]{Environment.NewLine}"); + foreach (var property in typeGroup.Properties) + { + var propertyAType = GetAssociativeType(property.PropertyType); + var propertyAText = propertyAType != null ? $" <{propertyAType.ToSyntaxTypeName()}>" : String.Empty; + var enumNames = GetEnumFieldNames(property.PropertyType.Unwrap()); + var enumNamesText = enumNames.Any() ? $" **{{{String.Join(", ", enumNames)}}}**" : String.Empty; + sb.Append($" - {property.Name} `{property.PropertyType.ToSyntaxTypeName()}{propertyAText}`{enumNamesText}{Environment.NewLine}"); + } + sb.AppendLine(); + } + + return sb; + } + + //https://stackoverflow.com/a/4963190/294804 + private static Type GetAssociativeType(Type type) => + type.GetInterfaces().FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>))?.GetGenericArguments().First(); + + private static string[] GetEnumFieldNames(Type type) => + type.IsValueType && !type.IsPrimitive && type != typeof(decimal) && type != typeof(DateTime) + ? type.GetFields(BindingFlags.Public | BindingFlags.Static).Where(f => f.FieldType == type).Select(p => p.Name).ToArray() + : new string[] { }; + + private class ModelTypeInfo + { + public Type Type { get; set; } + public string TypeName { get; set; } + public PropertyInfo[] Properties { get; set; } + public string NamespaceGroup { get; set; } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs new file mode 100644 index 000000000000..b88d4ac2595a --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -0,0 +1,159 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownRenderer; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "ProxyCmdlet", DefaultParameterSetName = "Docs")] + [DoNotExport] + public class ExportProxyCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string[] ModulePath { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string InternalFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [AllowEmptyString] + public string ModuleDescription { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string DocsFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + [ValidateNotNullOrEmpty] + public string ExamplesFolder { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "Docs")] + public Guid ModuleGuid { get; set; } + + [Parameter(Mandatory = true, ParameterSetName = "NoDocs")] + public SwitchParameter ExcludeDocs { get; set; } + + protected override void ProcessRecord() + { + try { + var variants = GetModuleCmdletsAndHelpInfo(this, ModulePath).SelectMany(ci => ci.ToVariants()).Where(v => !v.IsDoNotExport).ToArray(); + var allProfiles = variants.SelectMany(v => v.Profiles).Distinct().ToArray(); + var profileGroups = allProfiles.Any() + ? variants + .SelectMany(v => (v.Profiles.Any() ? v.Profiles : allProfiles).Select(p => (profile: p, variant: v))) + .GroupBy(pv => pv.profile) + .Select(pvg => new ProfileGroup(pvg.Select(pv => pv.variant).ToArray(), pvg.Key)) + : new[] { new ProfileGroup(variants) }; + var variantGroups = profileGroups.SelectMany(pg => pg.Variants + .GroupBy(v => new { v.CmdletName, v.IsInternal }) + .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + .ToArray(); + + foreach (var variantGroup in variantGroups) + { + var parameterGroups = variantGroup.ParameterGroups.ToList(); + var isValidProfile = !String.IsNullOrEmpty(variantGroup.ProfileName) && variantGroup.ProfileName != NoProfiles; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, variantGroup.ProfileName) : ExamplesFolder; + var markdownInfo = new MarkdownHelpInfo(variantGroup, examplesFolder); + List examples = new List(); + foreach (var it in markdownInfo.Examples) + { + examples.Add(it); + } + variantGroup.HelpInfo.Examples = examples.ToArray(); + var sb = new StringBuilder(); + sb.Append(@" +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the ""License""); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an ""AS IS"" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +"); + sb.Append($"{Environment.NewLine}"); + sb.Append(variantGroup.ToHelpCommentOutput()); + sb.Append($"function {variantGroup.CmdletName} {{{Environment.NewLine}"); + sb.Append(variantGroup.Aliases.ToAliasOutput()); + sb.Append(variantGroup.OutputTypes.ToOutputTypeOutput()); + sb.Append(variantGroup.ToCmdletBindingOutput()); + sb.Append(variantGroup.ProfileName.ToProfileOutput()); + + sb.Append("param("); + sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) + { + var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; + foreach (var parameter in parameters) + { + sb.Append(parameter.ToParameterOutput(variantGroup.HasMultipleVariants, parameterGroup.HasAllVariants)); + } + sb.Append(parameterGroup.Aliases.ToAliasOutput(true)); + sb.Append(parameterGroup.HasValidateNotNull.ToValidateNotNullOutput()); + sb.Append(parameterGroup.CompleterInfo.ToArgumentCompleterOutput()); + sb.Append(parameterGroup.OrderCategory.ToParameterCategoryOutput()); + sb.Append(parameterGroup.InfoAttribute.ToInfoOutput(parameterGroup.ParameterType)); + sb.Append(parameterGroup.ToDefaultInfoOutput()); + sb.Append(parameterGroup.ParameterType.ToParameterTypeOutput()); + sb.Append(parameterGroup.Description.ToParameterDescriptionOutput()); + sb.Append(parameterGroup.ParameterName.ToParameterNameOutput(parameterGroups.IndexOf(parameterGroup) == parameterGroups.Count - 1)); + } + sb.Append($"){Environment.NewLine}{Environment.NewLine}"); + + sb.Append(variantGroup.ToBeginOutput()); + sb.Append(variantGroup.ToProcessOutput()); + sb.Append(variantGroup.ToEndOutput()); + + sb.Append($"}}{Environment.NewLine}"); + + Directory.CreateDirectory(variantGroup.OutputFolder); + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + + File.AppendAllText(Path.Combine(variantGroup.OutputFolder, "ProxyCmdletDefinitions.ps1"), sb.ToString()); + } + + if (!ExcludeDocs) + { + var moduleInfo = new PsModuleHelpInfo(ModuleName, ModuleGuid, ModuleDescription); + foreach (var variantGroupsByProfile in variantGroups.GroupBy(vg => vg.ProfileName)) + { + var profileName = variantGroupsByProfile.Key; + var isValidProfile = !String.IsNullOrEmpty(profileName) && profileName != NoProfiles; + var docsFolder = isValidProfile ? Path.Combine(DocsFolder, profileName) : DocsFolder; + var examplesFolder = isValidProfile ? Path.Combine(ExamplesFolder, profileName) : ExamplesFolder; + WriteMarkdowns(variantGroupsByProfile, moduleInfo, docsFolder, examplesFolder); + } + } + } catch (Exception ee) { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs new file mode 100644 index 000000000000..3100e4cf9c03 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportPsd1.cs @@ -0,0 +1,125 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "Psd1")] + [DoNotExport] + public class ExportPsd1 : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string CustomFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + [Parameter(Mandatory = true)] + public Guid ModuleGuid { get; set; } + + private static readonly bool IsAzure = Convert.ToBoolean(@"true"); + private const string CustomFolderRelative = "./custom"; + private const string Indent = Psd1Indent; + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + if (!Directory.Exists(CustomFolder)) + { + throw new ArgumentException($"Custom folder '{CustomFolder}' does not exist"); + } + + string version = Convert.ToString(@"0.1.0"); + // Validate the module version should be semantic version + // Following regex is official from https://semver.org/ + Regex rx = new Regex(@"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$", RegexOptions.Compiled); + if (rx.Matches(version).Count != 1) + { + throw new ArgumentException("Module-version is not a valid Semantic Version"); + } + + string previewVersion = null; + if (version.Contains('-')) + { + string[] versions = version.Split("-".ToCharArray(), 2); + version = versions[0]; + previewVersion = versions[1]; + } + + var sb = new StringBuilder(); + sb.AppendLine("@{"); + sb.AppendLine($@"{GuidStart} = '{ModuleGuid}'"); + sb.AppendLine($@"{Indent}RootModule = '{"./Az.Blockchain.psm1"}'"); + sb.AppendLine($@"{Indent}ModuleVersion = '{version}'"); + sb.AppendLine($@"{Indent}CompatiblePSEditions = 'Core', 'Desktop'"); + sb.AppendLine($@"{Indent}Author = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}CompanyName = '{"Microsoft Corporation"}'"); + sb.AppendLine($@"{Indent}Copyright = '{"Microsoft Corporation. All rights reserved."}'"); + sb.AppendLine($@"{Indent}Description = '{"Microsoft Azure PowerShell: Blockchain cmdlets"}'"); + sb.AppendLine($@"{Indent}PowerShellVersion = '5.1'"); + sb.AppendLine($@"{Indent}DotNetFrameworkVersion = '4.7.2'"); + sb.AppendLine($@"{Indent}RequiredAssemblies = '{"./bin/Az.Blockchain.private.dll"}'"); + + var customFormatPs1xmlFiles = Directory.GetFiles(CustomFolder) + .Where(f => f.EndsWith(".format.ps1xml")) + .Select(f => $"{CustomFolderRelative}/{Path.GetFileName(f)}"); + var formatList = customFormatPs1xmlFiles.Prepend("./Az.Blockchain.format.ps1xml").ToPsList(); + sb.AppendLine($@"{Indent}FormatsToProcess = {formatList}"); + + var functionInfos = GetScriptCmdlets(ExportsFolder).ToArray(); + var cmdletsList = functionInfos.Select(fi => fi.Name).Distinct().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}FunctionsToExport = {cmdletsList}"); + var aliasesList = functionInfos.SelectMany(fi => fi.ScriptBlock.Attributes).ToAliasNames().Append("*").ToPsList(); + sb.AppendLine($@"{Indent}AliasesToExport = {aliasesList}"); + + sb.AppendLine($@"{Indent}PrivateData = @{{"); + sb.AppendLine($@"{Indent}{Indent}PSData = @{{"); + + if (previewVersion != null) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Prerelease = {previewVersion}"); + } + sb.AppendLine($@"{Indent}{Indent}{Indent}Tags = {"Azure ResourceManager ARM PSModule Blockchain".Split(' ').ToPsList().NullIfEmpty() ?? "''"}"); + sb.AppendLine($@"{Indent}{Indent}{Indent}LicenseUri = '{"https://aka.ms/azps-license"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ProjectUri = '{"https://github.com/Azure/azure-powershell"}'"); + sb.AppendLine($@"{Indent}{Indent}{Indent}ReleaseNotes = ''"); + var profilesList = ""; + if (IsAzure && !String.IsNullOrEmpty(profilesList)) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}Profiles = {profilesList}"); + } + + sb.AppendLine($@"{Indent}{Indent}}}"); + sb.AppendLine($@"{Indent}}}"); + sb.AppendLine(@"}"); + + File.WriteAllText(Psd1Path, sb.ToString()); + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs new file mode 100644 index 000000000000..5100a4dfb707 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/ExportTestStub.cs @@ -0,0 +1,137 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsData.Export, "TestStub")] + [DoNotExport] + public class ExportTestStub : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ModuleName { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ExportsFolder { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string OutputFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeGenerated { get; set; } + + protected override void ProcessRecord() + { + try + { + if (!Directory.Exists(ExportsFolder)) + { + throw new ArgumentException($"Exports folder '{ExportsFolder}' does not exist"); + } + + var exportDirectories = Directory.GetDirectories(ExportsFolder); + if (!exportDirectories.Any()) + { + exportDirectories = new[] { ExportsFolder }; + } + var utilFile = Path.Combine(OutputFolder, "utils.ps1"); + if (!File.Exists(utilFile)) + { + var sc = new StringBuilder(); + sc.AppendLine(@"function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing +} +"); + File.WriteAllText(utilFile, sc.ToString()); + } + foreach (var exportDirectory in exportDirectories) + { + var outputFolder = OutputFolder; + if (exportDirectory != ExportsFolder) + { + outputFolder = Path.Combine(OutputFolder, Path.GetFileName(exportDirectory)); + Directory.CreateDirectory(outputFolder); + } + + var variantGroups = GetScriptCmdlets(exportDirectory) + .SelectMany(fi => fi.ToVariants()) + .Where(v => !v.IsDoNotExport) + .GroupBy(v => v.CmdletName) + .Select(vg => new VariantGroup(ModuleName, vg.Key, vg.Select(v => v).ToArray(), outputFolder, isTest: true)) + .Where(vtg => !File.Exists(vtg.FilePath) && (IncludeGenerated || !vtg.IsGenerated)); + + foreach (var variantGroup in variantGroups) + { + var sb = new StringBuilder(); + sb.AppendLine(@"$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath)" +); + sb.AppendLine($@"$TestRecordingFile = Join-Path $PSScriptRoot '{variantGroup.CmdletName}.Recording.json'"); + sb.AppendLine(@"$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName +"); + + sb.AppendLine($"Describe '{variantGroup.CmdletName}' {{"); + var variants = variantGroup.Variants + .Where(v => IncludeGenerated || !v.Attributes.OfType().Any()) + .ToList(); + + foreach (var variant in variants) + { + sb.AppendLine($"{Indent}It '{variant.VariantName}' -skip {{"); + sb.AppendLine($"{Indent}{Indent}{{ throw [System.NotImplementedException] }} | Should -Not -Throw"); + var variantSeparator = variants.IndexOf(variant) == variants.Count - 1 ? String.Empty : Environment.NewLine; + sb.AppendLine($"{Indent}}}{variantSeparator}"); + } + sb.AppendLine("}"); + + File.WriteAllText(variantGroup.FilePath, sb.ToString()); + } + } + } + catch (Exception ee) + { + Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs new file mode 100644 index 000000000000..57b22df4e269 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetCommonParameter.cs @@ -0,0 +1,52 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "CommonParameter")] + [OutputType(typeof(Dictionary))] + [DoNotExport] + public class GetCommonParameter : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public PSCmdlet PSCmdlet { get; set; } + + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public Dictionary PSBoundParameter { get; set; } + + protected override void ProcessRecord() + { + try + { + var variants = PSCmdlet.MyInvocation.MyCommand.ToVariants(); + var commonParameterNames = variants.ToParameterGroups() + .Where(pg => pg.OrderCategory == ParameterCategory.Azure || pg.OrderCategory == ParameterCategory.Runtime) + .Select(pg => pg.ParameterName); + if (variants.Any(v => v.SupportsShouldProcess)) + { + commonParameterNames = commonParameterNames.Append("Confirm").Append("WhatIf"); + } + if (variants.Any(v => v.SupportsPaging)) + { + commonParameterNames = commonParameterNames.Append("First").Append("Skip").Append("IncludeTotalCount"); + } + + var names = commonParameterNames.ToArray(); + var keys = PSBoundParameter.Keys.Where(k => names.Contains(k)); + WriteObject(keys.ToDictionary(key => key, key => PSBoundParameter[key]), true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs new file mode 100644 index 000000000000..71ea6485253b --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetModuleGuid.cs @@ -0,0 +1,31 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ModuleGuid")] + [DoNotExport] + public class GetModuleGuid : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string Psd1Path { get; set; } + + protected override void ProcessRecord() + { + try + { + WriteObject(ReadGuidFromPsd1(Psd1Path)); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs new file mode 100644 index 000000000000..cf81e631a092 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Cmdlets/GetScriptCmdlet.cs @@ -0,0 +1,53 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpers; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + [Cmdlet(VerbsCommon.Get, "ScriptCmdlet")] + [OutputType(typeof(string[]))] + [DoNotExport] + public class GetScriptCmdlet : PSCmdlet + { + [Parameter(Mandatory = true)] + [ValidateNotNullOrEmpty] + public string ScriptFolder { get; set; } + + [Parameter] + public SwitchParameter IncludeDoNotExport { get; set; } + + [Parameter] + public SwitchParameter AsAlias { get; set; } + + [Parameter] + public SwitchParameter AsFunctionInfo { get; set; } + + protected override void ProcessRecord() + { + try + { + var functionInfos = GetScriptCmdlets(this, ScriptFolder) + .Where(fi => IncludeDoNotExport || !fi.ScriptBlock.Attributes.OfType().Any()) + .ToArray(); + if (AsFunctionInfo) + { + WriteObject(functionInfos, true); + return; + } + var aliases = functionInfos.SelectMany(i => i.ScriptBlock.Attributes).ToAliasNames(); + var names = functionInfos.Select(fi => fi.Name).Distinct(); + var output = (AsAlias ? aliases : names).DefaultIfEmpty("''").ToArray(); + WriteObject(output, true); + } + catch (System.Exception ee) + { + System.Console.WriteLine($"${ee.GetType().Name}/{ee.StackTrace}"); + throw ee; + } + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs new file mode 100644 index 000000000000..363c598724ce --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/CollectionExtensions.cs @@ -0,0 +1,20 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class CollectionExtensions + { + public static T[] NullIfEmpty(this T[] collection) => (collection?.Any() ?? false) ? collection : null; + public static IEnumerable EmptyIfNull(this IEnumerable collection) => collection ?? Enumerable.Empty(); + + // https://stackoverflow.com/a/4158364/294804 + public static IEnumerable DistinctBy(this IEnumerable collection, Func selector) => + collection.GroupBy(selector).Select(group => group.First()); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs new file mode 100644 index 000000000000..0b3b3f9d92e6 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class MarkdownRenderer + { + public static void WriteMarkdowns(IEnumerable variantGroups, PsModuleHelpInfo moduleHelpInfo, string docsFolder, string examplesFolder) + { + Directory.CreateDirectory(docsFolder); + var markdownInfos = variantGroups.Where(vg => !vg.IsInternal).Select(vg => new MarkdownHelpInfo(vg, examplesFolder)).OrderBy(mhi => mhi.CmdletName).ToArray(); + + foreach (var markdownInfo in markdownInfos) + { + var sb = new StringBuilder(); + sb.Append(markdownInfo.ToHelpMetadataOutput()); + sb.Append($"# {markdownInfo.CmdletName}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"## SYNOPSIS{Environment.NewLine}{markdownInfo.Synopsis.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## SYNTAX{Environment.NewLine}{Environment.NewLine}"); + var hasMultipleParameterSets = markdownInfo.SyntaxInfos.Length > 1; + foreach (var syntaxInfo in markdownInfo.SyntaxInfos) + { + sb.Append(syntaxInfo.ToHelpSyntaxOutput(hasMultipleParameterSets)); + } + + sb.Append($"## DESCRIPTION{Environment.NewLine}{markdownInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## EXAMPLES{Environment.NewLine}{Environment.NewLine}"); + foreach (var exampleInfo in markdownInfo.Examples) + { + sb.Append(exampleInfo.ToHelpExampleOutput()); + } + + sb.Append($"## PARAMETERS{Environment.NewLine}{Environment.NewLine}"); + foreach (var parameter in markdownInfo.Parameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + if (markdownInfo.SupportsShouldProcess) + { + foreach (var parameter in SupportsShouldProcessParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + if (markdownInfo.SupportsPaging) + { + foreach (var parameter in SupportsPagingParameters) + { + sb.Append(parameter.ToHelpParameterOutput()); + } + } + + sb.Append($"### CommonParameters{Environment.NewLine}This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## INPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var input in markdownInfo.Inputs) + { + sb.Append($"### {input}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## OUTPUTS{Environment.NewLine}{Environment.NewLine}"); + foreach (var output in markdownInfo.Outputs) + { + sb.Append($"### {output}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## NOTES{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"ALIASES{Environment.NewLine}{Environment.NewLine}"); + foreach (var alias in markdownInfo.Aliases) + { + sb.Append($"### {alias}{Environment.NewLine}{Environment.NewLine}"); + } + if (markdownInfo.ComplexInterfaceInfos.Any()) + { + sb.Append($"{ComplexParameterHeader}{Environment.NewLine}"); + } + foreach (var complexInterfaceInfo in markdownInfo.ComplexInterfaceInfos) + { + sb.Append($"{complexInterfaceInfo.ToNoteOutput(includeDashes: true, includeBackticks: true)}{Environment.NewLine}{Environment.NewLine}"); + } + + sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); + foreach (var relatedLink in markdownInfo.RelatedLinks) + { + sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); + } + + WriteModulePage(moduleHelpInfo, markdownInfos, docsFolder); + } + + private static void WriteModulePage(PsModuleHelpInfo moduleInfo, MarkdownHelpInfo[] markdownInfos, string docsFolder) + { + var sb = new StringBuilder(); + sb.Append(moduleInfo.ToModulePageMetadataOutput()); + sb.Append($"# {moduleInfo.Name} Module{Environment.NewLine}"); + sb.Append($"## Description{Environment.NewLine}{moduleInfo.Description.ToDescriptionFormat()}{Environment.NewLine}{Environment.NewLine}"); + + sb.Append($"## {moduleInfo.Name} Cmdlets{Environment.NewLine}"); + foreach (var markdownInfo in markdownInfos) + { + sb.Append(markdownInfo.ToModulePageCmdletOutput()); + } + + File.WriteAllText(Path.Combine(docsFolder, $"{moduleInfo.Name}.md"), sb.ToString()); + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs new file mode 100644 index 000000000000..f8173919e24f --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsFormatTypes.cs @@ -0,0 +1,138 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class ViewParameters + { + public Type Type { get; } + public IEnumerable Properties { get; } + + public ViewParameters(Type type, IEnumerable properties) + { + Type = type; + Properties = properties; + } + } + + internal class PropertyFormat + { + public PropertyInfo Property { get; } + public FormatTableAttribute FormatTable { get; } + + public int? Index { get; } + public string Label { get; } + public int? Width { get; } + public PropertyOrigin? Origin { get; } + + public PropertyFormat(PropertyInfo propertyInfo) + { + Property = propertyInfo; + FormatTable = Property.GetCustomAttributes().FirstOrDefault(); + var origin = Property.GetCustomAttributes().FirstOrDefault(); + + Index = FormatTable?.HasIndex ?? false ? (int?)FormatTable.Index : null; + Label = FormatTable?.Label ?? propertyInfo.Name; + Width = FormatTable?.HasWidth ?? false ? (int?)FormatTable.Width : null; + // If we have an index, we don't want to use Origin. + Origin = FormatTable?.HasIndex ?? false ? null : origin?.Origin; + } + } + + [Serializable] + [XmlRoot(nameof(Configuration))] + public class Configuration + { + [XmlElement("ViewDefinitions")] + public ViewDefinitions ViewDefinitions { get; set; } + } + + [Serializable] + public class ViewDefinitions + { + //https://stackoverflow.com/a/10518657/294804 + [XmlElement("View")] + public List Views { get; set; } + } + + [Serializable] + public class View + { + [XmlElement(nameof(Name))] + public string Name { get; set; } + [XmlElement(nameof(ViewSelectedBy))] + public ViewSelectedBy ViewSelectedBy { get; set; } + [XmlElement(nameof(TableControl))] + public TableControl TableControl { get; set; } + } + + [Serializable] + public class ViewSelectedBy + { + [XmlElement(nameof(TypeName))] + public string TypeName { get; set; } + } + + [Serializable] + public class TableControl + { + [XmlElement(nameof(TableHeaders))] + public TableHeaders TableHeaders { get; set; } + [XmlElement(nameof(TableRowEntries))] + public TableRowEntries TableRowEntries { get; set; } + } + + [Serializable] + public class TableHeaders + { + [XmlElement("TableColumnHeader")] + public List TableColumnHeaders { get; set; } + } + + [Serializable] + public class TableColumnHeader + { + [XmlElement(nameof(Label))] + public string Label { get; set; } + [XmlElement(nameof(Width))] + public int? Width { get; set; } + + //https://stackoverflow.com/a/4095225/294804 + public bool ShouldSerializeWidth() => Width.HasValue; + } + + [Serializable] + public class TableRowEntries + { + [XmlElement(nameof(TableRowEntry))] + public TableRowEntry TableRowEntry { get; set; } + } + + [Serializable] + public class TableRowEntry + { + [XmlElement(nameof(TableColumnItems))] + public TableColumnItems TableColumnItems { get; set; } + } + + [Serializable] + public class TableColumnItems + { + [XmlElement("TableColumnItem")] + public List TableItems { get; set; } + } + + [Serializable] + public class TableColumnItem + { + [XmlElement(nameof(PropertyName))] + public string PropertyName { get; set; } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs new file mode 100644 index 000000000000..e4b2d2cccb80 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpMarkdownOutputs.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class HelpMetadataOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public HelpMetadataOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"--- +external help file:{(!String.IsNullOrEmpty(HelpInfo.ExternalHelpFilename) ? $" {HelpInfo.ExternalHelpFilename}" : String.Empty)} +Module Name: {HelpInfo.ModuleName} +online version: {HelpInfo.OnlineVersion} +schema: {HelpInfo.Schema.ToString(3)} +--- + +"; + } + + internal class HelpSyntaxOutput + { + public MarkdownSyntaxHelpInfo SyntaxInfo { get; } + public bool HasMultipleParameterSets { get; } + + public HelpSyntaxOutput(MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) + { + SyntaxInfo = syntaxInfo; + HasMultipleParameterSets = hasMultipleParameterSets; + } + + public override string ToString() + { + var psnText = HasMultipleParameterSets ? $"### {SyntaxInfo.ParameterSetName}{(SyntaxInfo.IsDefault ? " (Default)" : String.Empty)}{Environment.NewLine}" : String.Empty; + return $@"{psnText}``` +{SyntaxInfo.SyntaxText} +``` + +"; + } + } + + internal class HelpExampleOutput + { + public MarkdownExampleHelpInfo ExampleInfo { get; } + + public HelpExampleOutput(MarkdownExampleHelpInfo exampleInfo) + { + ExampleInfo = exampleInfo; + } + + public override string ToString() => $@"{ExampleNameHeader}{ExampleInfo.Name} +{ExampleCodeHeader} +{ExampleInfo.Code} +{ExampleCodeFooter} + +{ExampleInfo.Description.ToDescriptionFormat()} + +"; + } + + + internal class HelpParameterOutput + { + public MarkdownParameterHelpInfo ParameterInfo { get; } + + public HelpParameterOutput(MarkdownParameterHelpInfo parameterInfo) + { + ParameterInfo = parameterInfo; + } + + public override string ToString() + { + var pipelineInputTypes = new[] + { + ParameterInfo.AcceptsPipelineByValue ? "ByValue" : String.Empty, + ParameterInfo.AcceptsPipelineByPropertyName ? "ByPropertyName" : String.Empty + }.JoinIgnoreEmpty(", "); + var pipelineInput = ParameterInfo.AcceptsPipelineByValue || ParameterInfo.AcceptsPipelineByPropertyName + ? $@"{true} ({pipelineInputTypes})" + : false.ToString(); + + return $@"### -{ParameterInfo.Name} +{ParameterInfo.Description.ToDescriptionFormat()} + +```yaml +Type: {ParameterInfo.Type.FullName} +Parameter Sets: {(ParameterInfo.HasAllParameterSets ? "(All)" : ParameterInfo.ParameterSetNames.JoinIgnoreEmpty(", "))} +Aliases:{(ParameterInfo.Aliases.Any() ? $" {ParameterInfo.Aliases.JoinIgnoreEmpty(", ")}" : String.Empty)} + +Required: {ParameterInfo.IsRequired} +Position: {ParameterInfo.Position} +Default value: {ParameterInfo.DefaultValue} +Accept pipeline input: {pipelineInput} +Accept wildcard characters: {ParameterInfo.AcceptsWildcardCharacters} +``` + +"; + } + } + + internal class ModulePageMetadataOutput + { + public PsModuleHelpInfo ModuleInfo { get; } + + private static string HelpLinkPrefix { get; } = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public ModulePageMetadataOutput(PsModuleHelpInfo moduleInfo) + { + ModuleInfo = moduleInfo; + } + + public override string ToString() => $@"--- +Module Name: {ModuleInfo.Name} +Module Guid: {ModuleInfo.Guid} +Download Help Link: {HelpLinkPrefix}{ModuleInfo.Name.ToLowerInvariant()} +Help Version: 1.0.0.0 +Locale: en-US +--- + +"; + } + + internal class ModulePageCmdletOutput + { + public MarkdownHelpInfo HelpInfo { get; } + + public ModulePageCmdletOutput(MarkdownHelpInfo helpInfo) + { + HelpInfo = helpInfo; + } + + public override string ToString() => $@"### [{HelpInfo.CmdletName}]({HelpInfo.CmdletName}.md) +{HelpInfo.Description.ToDescriptionFormat()} + +"; + } + + internal static class PsHelpOutputExtensions + { + public static string EscapeAngleBrackets(this string text) => text?.Replace("<", @"\<").Replace(">", @"\>"); + public static string ReplaceSentenceEndWithNewline(this string text) => text?.Replace(". ", $".{Environment.NewLine}").Replace(". ", $".{Environment.NewLine}"); + public static string ReplaceBrWithNewline(this string text) => text?.Replace("
", $"{Environment.NewLine}"); + public static string ToDescriptionFormat(this string text, bool escapeAngleBrackets = true) + { + var description = text?.ReplaceBrWithNewline(); + description = escapeAngleBrackets ? description?.EscapeAngleBrackets() : description; + return description?.ReplaceSentenceEndWithNewline().Trim(); + } + + public const string ExampleNameHeader = "### "; + public const string ExampleCodeHeader = "```powershell"; + public const string ExampleCodeFooter = "```"; + + public static HelpMetadataOutput ToHelpMetadataOutput(this MarkdownHelpInfo helpInfo) => new HelpMetadataOutput(helpInfo); + + public static HelpSyntaxOutput ToHelpSyntaxOutput(this MarkdownSyntaxHelpInfo syntaxInfo, bool hasMultipleParameterSets) => new HelpSyntaxOutput(syntaxInfo, hasMultipleParameterSets); + + public static HelpExampleOutput ToHelpExampleOutput(this MarkdownExampleHelpInfo exampleInfo) => new HelpExampleOutput(exampleInfo); + + public static HelpParameterOutput ToHelpParameterOutput(this MarkdownParameterHelpInfo parameterInfo) => new HelpParameterOutput(parameterInfo); + + public static ModulePageMetadataOutput ToModulePageMetadataOutput(this PsModuleHelpInfo moduleInfo) => new ModulePageMetadataOutput(moduleInfo); + + public static ModulePageCmdletOutput ToModulePageCmdletOutput(this MarkdownHelpInfo helpInfo) => new ModulePageCmdletOutput(helpInfo); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs new file mode 100644 index 000000000000..9cd34da5c98c --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsHelpTypes.cs @@ -0,0 +1,199 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class PsHelpInfo + { + public string CmdletName { get; } + public string ModuleName { get; } + public string Synopsis { get; } + public string Description { get; } + public string AlertText { get; } + public string Category { get; } + public PsHelpLinkInfo OnlineVersion { get; } + public PsHelpLinkInfo[] RelatedLinks { get; } + public bool? HasCommonParameters { get; } + public bool? HasWorkflowCommonParameters { get; } + + public PsHelpTypeInfo[] InputTypes { get; } + public PsHelpTypeInfo[] OutputTypes { get; } + public PsHelpExampleInfo[] Examples { get; set; } + public string[] Aliases { get; } + + public PsParameterHelpInfo[] Parameters { get; } + public PsHelpSyntaxInfo[] Syntax { get; } + + public object Component { get; } + public object Functionality { get; } + public object PsSnapIn { get; } + public object Role { get; } + public string NonTerminatingErrors { get; } + + public PsHelpInfo(PSObject helpObject = null) + { + helpObject = helpObject ?? new PSObject(); + CmdletName = helpObject.GetProperty("Name").NullIfEmpty() ?? helpObject.GetNestedProperty("details", "name"); + ModuleName = helpObject.GetProperty("ModuleName"); + Synopsis = helpObject.GetProperty("Synopsis"); + Description = helpObject.GetProperty("description").EmptyIfNull().ToDescriptionText().NullIfEmpty() ?? + helpObject.GetNestedProperty("details", "description").EmptyIfNull().ToDescriptionText(); + AlertText = helpObject.GetNestedProperty("alertSet", "alert").EmptyIfNull().ToDescriptionText(); + Category = helpObject.GetProperty("Category"); + HasCommonParameters = helpObject.GetProperty("CommonParameters").ToNullableBool(); + HasWorkflowCommonParameters = helpObject.GetProperty("WorkflowCommonParameters").ToNullableBool(); + + var links = helpObject.GetNestedProperty("relatedLinks", "navigationLink").EmptyIfNull().Select(nl => nl.ToLinkInfo()).ToArray(); + OnlineVersion = links.FirstOrDefault(l => l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length == 1); + RelatedLinks = links.Where(l => !l.Text?.ToLowerInvariant().StartsWith("online version:") ?? links.Length != 1).ToArray(); + + InputTypes = helpObject.GetNestedProperty("inputTypes", "inputType").EmptyIfNull().Select(it => it.ToTypeInfo()).ToArray(); + OutputTypes = helpObject.GetNestedProperty("returnValues", "returnValue").EmptyIfNull().Select(rv => rv.ToTypeInfo()).ToArray(); + Examples = helpObject.GetNestedProperty("examples", "example").EmptyIfNull().Select(e => e.ToExampleInfo()).ToArray(); + Aliases = helpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); + + Parameters = helpObject.GetNestedProperty("parameters", "parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + Syntax = helpObject.GetNestedProperty("syntax", "syntaxItem").EmptyIfNull().Select(si => si.ToSyntaxInfo()).ToArray(); + + Component = helpObject.GetProperty("Component"); + Functionality = helpObject.GetProperty("Functionality"); + PsSnapIn = helpObject.GetProperty("PSSnapIn"); + Role = helpObject.GetProperty("Role"); + NonTerminatingErrors = helpObject.GetProperty("nonTerminatingErrors"); + } + } + + internal class PsHelpTypeInfo + { + public string Name { get; } + public string Description { get; } + + public PsHelpTypeInfo(PSObject typeObject) + { + Name = typeObject.GetNestedProperty("type", "name").EmptyIfNull().Trim(); + Description = typeObject.GetProperty("description").EmptyIfNull().ToDescriptionText(); + } + } + + internal class PsHelpLinkInfo + { + public string Uri { get; } + public string Text { get; } + + public PsHelpLinkInfo(PSObject linkObject) + { + Uri = linkObject.GetProperty("uri"); + Text = linkObject.GetProperty("linkText"); + } + } + + internal class PsHelpSyntaxInfo + { + public string CmdletName { get; } + public PsParameterHelpInfo[] Parameters { get; } + + public PsHelpSyntaxInfo(PSObject syntaxObject) + { + CmdletName = syntaxObject.GetProperty("name"); + Parameters = syntaxObject.GetProperty("parameter").EmptyIfNull().Select(p => p.ToPsParameterHelpInfo()).ToArray(); + } + } + + internal class PsHelpExampleInfo + { + public string Title { get; } + public string Code { get; } + public string Remarks { get; } + + public PsHelpExampleInfo(PSObject exampleObject) + { + Title = exampleObject.GetProperty("title"); + Code = exampleObject.GetProperty("code"); + Remarks = exampleObject.GetProperty("remarks").EmptyIfNull().ToDescriptionText(); + } + public PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) + { + Title = markdownExample.Name; + Code = markdownExample.Code; + Remarks = markdownExample.Description; + } + + public static implicit operator PsHelpExampleInfo(MarkdownExampleHelpInfo markdownExample) => new PsHelpExampleInfo(markdownExample); + } + + internal class PsParameterHelpInfo + { + public string DefaultValueAsString { get; } + + public string Name { get; } + public string TypeName { get; } + public string Description { get; } + public string SupportsPipelineInput { get; } + public string PositionText { get; } + public string[] ParameterSetNames { get; } + public string[] Aliases { get; } + + public bool? SupportsGlobbing { get; } + public bool? IsRequired { get; } + public bool? IsVariableLength { get; } + public bool? IsDynamic { get; } + + public PsParameterHelpInfo(PSObject parameterHelpObject = null) + { + parameterHelpObject = parameterHelpObject ?? new PSObject(); + DefaultValueAsString = parameterHelpObject.GetProperty("defaultValue"); + Name = parameterHelpObject.GetProperty("name"); + TypeName = parameterHelpObject.GetProperty("parameterValue").NullIfEmpty() ?? parameterHelpObject.GetNestedProperty("type", "name"); + Description = parameterHelpObject.GetProperty("Description").EmptyIfNull().ToDescriptionText(); + SupportsPipelineInput = parameterHelpObject.GetProperty("pipelineInput"); + PositionText = parameterHelpObject.GetProperty("position"); + ParameterSetNames = parameterHelpObject.GetProperty("parameterSetName").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + Aliases = parameterHelpObject.GetProperty("aliases").EmptyIfNull().Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); + + SupportsGlobbing = parameterHelpObject.GetProperty("globbing").ToNullableBool(); + IsRequired = parameterHelpObject.GetProperty("required").ToNullableBool(); + IsVariableLength = parameterHelpObject.GetProperty("variableLength").ToNullableBool(); + IsDynamic = parameterHelpObject.GetProperty("isDynamic").ToNullableBool(); + } + } + + internal class PsModuleHelpInfo + { + public string Name { get; } + public Guid Guid { get; } + public string Description { get; } + + public PsModuleHelpInfo(PSModuleInfo moduleInfo) + : this(moduleInfo?.Name ?? String.Empty, moduleInfo?.Guid ?? Guid.NewGuid(), moduleInfo?.Description ?? String.Empty) + { + } + + public PsModuleHelpInfo(string name, Guid guid, string description) + { + Name = name; + Guid = guid; + Description = description; + } + } + + internal static class HelpTypesExtensions + { + public static PsHelpInfo ToPsHelpInfo(this PSObject helpObject) => new PsHelpInfo(helpObject); + public static PsParameterHelpInfo ToPsParameterHelpInfo(this PSObject parameterHelpObject) => new PsParameterHelpInfo(parameterHelpObject); + + public static string ToDescriptionText(this IEnumerable descriptionObject) => descriptionObject != null + ? String.Join(Environment.NewLine, descriptionObject.Select(dl => dl.GetProperty("Text").EmptyIfNull())).NullIfWhiteSpace() + : null; + public static PsHelpTypeInfo ToTypeInfo(this PSObject typeObject) => new PsHelpTypeInfo(typeObject); + public static PsHelpExampleInfo ToExampleInfo(this PSObject exampleObject) => new PsHelpExampleInfo(exampleObject); + public static PsHelpLinkInfo ToLinkInfo(this PSObject linkObject) => new PsHelpLinkInfo(linkObject); + public static PsHelpSyntaxInfo ToSyntaxInfo(this PSObject syntaxObject) => new PsHelpSyntaxInfo(syntaxObject); + public static PsModuleHelpInfo ToModuleInfo(this PSModuleInfo moduleInfo) => new PsModuleHelpInfo(moduleInfo); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs new file mode 100644 index 000000000000..a73ef6b3d7aa --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsMarkdownTypes.cs @@ -0,0 +1,291 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.MarkdownTypesExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsHelpOutputExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class MarkdownHelpInfo + { + public string ExternalHelpFilename { get; } + public string ModuleName { get; } + public string OnlineVersion { get; } + public Version Schema { get; } + + public string CmdletName { get; } + public string[] Aliases { get; } + public string Synopsis { get; } + public string Description { get; } + + public MarkdownSyntaxHelpInfo[] SyntaxInfos { get; } + public MarkdownExampleHelpInfo[] Examples { get; } + public MarkdownParameterHelpInfo[] Parameters { get; } + + public string[] Inputs { get; } + public string[] Outputs { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + public string[] RelatedLinks { get; } + + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public MarkdownHelpInfo(VariantGroup variantGroup, string examplesFolder, string externalHelpFilename = "") + { + ExternalHelpFilename = externalHelpFilename; + ModuleName = variantGroup.ModuleName; + var helpInfo = variantGroup.HelpInfo; + var commentInfo = variantGroup.CommentInfo; + Schema = Version.Parse("2.0.0"); + + CmdletName = variantGroup.CmdletName; + Aliases = (variantGroup.Aliases.NullIfEmpty() ?? helpInfo.Aliases).Where(a => a != "None").ToArray(); + Synopsis = commentInfo.Synopsis; + Description = commentInfo.Description; + + SyntaxInfos = variantGroup.Variants + .Select(v => new MarkdownSyntaxHelpInfo(v, variantGroup.ParameterGroups, v.VariantName == variantGroup.DefaultParameterSetName)) + .OrderByDescending(v => v.IsDefault).ThenBy(v => v.ParameterSetName).ToArray(); + Examples = GetExamplesFromMarkdown(examplesFolder).NullIfEmpty() + ?? helpInfo.Examples.Select(e => e.ToExampleHelpInfo()).ToArray().NullIfEmpty() + ?? DefaultExampleHelpInfos; + + Parameters = variantGroup.ParameterGroups + .Where(pg => !pg.DontShow) + .Select(pg => new MarkdownParameterHelpInfo( + variantGroup.Variants.SelectMany(v => v.HelpInfo.Parameters).Where(phi => phi.Name == pg.ParameterName).ToArray(), pg)) + .OrderBy(phi => phi.Name).ToArray(); + + Inputs = commentInfo.Inputs; + Outputs = commentInfo.Outputs; + + ComplexInterfaceInfos = variantGroup.ComplexInterfaceInfos; + OnlineVersion = commentInfo.OnlineVersion; + RelatedLinks = commentInfo.RelatedLinks; + + SupportsShouldProcess = variantGroup.SupportsShouldProcess; + SupportsPaging = variantGroup.SupportsPaging; + } + + private MarkdownExampleHelpInfo[] GetExamplesFromMarkdown(string examplesFolder) + { + var filePath = Path.Combine(examplesFolder, $"{CmdletName}.md"); + if (!Directory.Exists(examplesFolder) || !File.Exists(filePath)) return null; + + var lines = File.ReadAllLines(filePath); + var nameIndices = lines.Select((l, i) => l.StartsWith(ExampleNameHeader) ? i : -1).Where(i => i != -1).ToArray(); + //https://codereview.stackexchange.com/a/187148/68772 + var indexCountGroups = nameIndices.Skip(1).Append(lines.Length).Zip(nameIndices, (next, current) => (NameIndex: current, LineCount: next - current)); + var exampleGroups = indexCountGroups.Select(icg => lines.Skip(icg.NameIndex).Take(icg.LineCount).ToArray()); + return exampleGroups.Select(eg => + { + var name = eg.First().Replace(ExampleNameHeader, String.Empty); + var codeStartIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeHeader) ? (int?)i : null).FirstOrDefault(i => i.HasValue); + var codeEndIndex = eg.Select((l, i) => l.StartsWith(ExampleCodeFooter) ? (int?)i : null).FirstOrDefault(i => i.HasValue && i != codeStartIndex); + var code = codeStartIndex.HasValue && codeEndIndex.HasValue + ? String.Join(Environment.NewLine, eg.Skip(codeStartIndex.Value + 1).Take(codeEndIndex.Value - (codeStartIndex.Value + 1))) + : String.Empty; + var descriptionStartIndex = (codeEndIndex ?? 0) + 1; + descriptionStartIndex = String.IsNullOrWhiteSpace(eg[descriptionStartIndex]) ? descriptionStartIndex + 1 : descriptionStartIndex; + var descriptionEndIndex = eg.Length - 1; + descriptionEndIndex = String.IsNullOrWhiteSpace(eg[descriptionEndIndex]) ? descriptionEndIndex - 1 : descriptionEndIndex; + var description = String.Join(Environment.NewLine, eg.Skip(descriptionStartIndex).Take((descriptionEndIndex + 1) - descriptionStartIndex)); + return new MarkdownExampleHelpInfo(name, code, description); + }).ToArray(); + } + } + + internal class MarkdownSyntaxHelpInfo + { + public Variant Variant { get; } + public bool IsDefault { get; } + public string ParameterSetName { get; } + public Parameter[] Parameters { get; } + public string SyntaxText { get; } + + public MarkdownSyntaxHelpInfo(Variant variant, ParameterGroup[] parameterGroups, bool isDefault) + { + Variant = variant; + IsDefault = isDefault; + ParameterSetName = Variant.VariantName; + Parameters = Variant.Parameters + .Where(p => !p.DontShow).OrderByDescending(p => p.IsMandatory) + //https://stackoverflow.com/a/6461526/294804 + .ThenByDescending(p => p.Position.HasValue).ThenBy(p => p.Position) + // Use the OrderCategory of the parameter group because the final order category is the highest of the group, and not the order category of the individual parameters from the variants. + .ThenBy(p => parameterGroups.First(pg => pg.ParameterName == p.ParameterName).OrderCategory).ThenBy(p => p.ParameterName).ToArray(); + SyntaxText = CreateSyntaxFormat(); + } + + //https://github.com/PowerShell/platyPS/blob/a607a926bfffe1e1a1e53c19e0057eddd0c07611/src/Markdown.MAML/Renderer/Markdownv2Renderer.cs#L29-L32 + private const int SyntaxLineWidth = 110; + private string CreateSyntaxFormat() + { + var parameterStrings = Parameters.Select(p => p.ToPropertySyntaxOutput().ToString()); + if (Variant.SupportsShouldProcess) + { + parameterStrings = parameterStrings.Append(" [-Confirm]").Append(" [-WhatIf]"); + } + if (Variant.SupportsPaging) + { + parameterStrings = parameterStrings.Append(" [-First ]").Append(" [-IncludeTotalCount]").Append(" [-Skip ]"); + } + parameterStrings = parameterStrings.Append(" []"); + + var lines = new List(20); + return parameterStrings.Aggregate(Variant.CmdletName, (current, ps) => + { + var combined = current + ps; + if (combined.Length <= SyntaxLineWidth) return combined; + + lines.Add(current); + return ps; + }, last => + { + lines.Add(last); + return String.Join(Environment.NewLine, lines); + }); + } + } + + internal class MarkdownExampleHelpInfo + { + public string Name { get; } + public string Code { get; } + public string Description { get; } + + public MarkdownExampleHelpInfo(string name, string code, string description) + { + Name = name; + Code = code; + Description = description; + } + } + + internal class MarkdownParameterHelpInfo + { + public string Name { get; set; } + public string Description { get; set; } + public Type Type { get; set; } + public string Position { get; set; } + public string DefaultValue { get; set; } + + public bool HasAllParameterSets { get; set; } + public string[] ParameterSetNames { get; set; } + public string[] Aliases { get; set; } + + public bool IsRequired { get; set; } + public bool IsDynamic { get; set; } + public bool AcceptsPipelineByValue { get; set; } + public bool AcceptsPipelineByPropertyName { get; set; } + public bool AcceptsWildcardCharacters { get; set; } + + // For use by common parameters that have no backing data in the objects themselves. + public MarkdownParameterHelpInfo() { } + + public MarkdownParameterHelpInfo(PsParameterHelpInfo[] parameterHelpInfos, ParameterGroup parameterGroup) + { + Name = parameterGroup.ParameterName; + Description = parameterGroup.Description.NullIfEmpty() + ?? parameterHelpInfos.Select(phi => phi.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + Type = parameterGroup.ParameterType; + Position = parameterGroup.FirstPosition?.ToString() + ?? parameterHelpInfos.Select(phi => phi.PositionText).FirstOrDefault(d => !String.IsNullOrEmpty(d)).ToUpperFirstCharacter().NullIfEmpty() + ?? "Named"; + // This no longer uses firstHelpInfo.DefaultValueAsString since it seems to be broken. For example, it has a value of 0 for Int32, but no default value was declared. + DefaultValue = parameterGroup.DefaultInfo?.Script ?? "None"; + + HasAllParameterSets = parameterGroup.HasAllVariants; + ParameterSetNames = (parameterGroup.Parameters.Select(p => p.VariantName).ToArray().NullIfEmpty() + ?? parameterHelpInfos.SelectMany(phi => phi.ParameterSetNames).Distinct()) + .OrderBy(psn => psn).ToArray(); + Aliases = parameterGroup.Aliases.NullIfEmpty() ?? parameterHelpInfos.SelectMany(phi => phi.Aliases).ToArray(); + + IsRequired = parameterHelpInfos.Select(phi => phi.IsRequired).FirstOrDefault(r => r == true) ?? parameterGroup.Parameters.Any(p => p.IsMandatory); + IsDynamic = parameterHelpInfos.Select(phi => phi.IsDynamic).FirstOrDefault(d => d == true) ?? false; + AcceptsPipelineByValue = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByValue")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipeline; + AcceptsPipelineByPropertyName = parameterHelpInfos.Select(phi => phi.SupportsPipelineInput?.Contains("ByPropertyName")).FirstOrDefault(bv => bv == true) ?? parameterGroup.ValueFromPipelineByPropertyName; + AcceptsWildcardCharacters = parameterGroup.SupportsWildcards; + } + } + + internal static class MarkdownTypesExtensions + { + public static MarkdownExampleHelpInfo ToExampleHelpInfo(this PsHelpExampleInfo exampleInfo) => new MarkdownExampleHelpInfo(exampleInfo.Title, exampleInfo.Code, exampleInfo.Remarks); + + public static MarkdownExampleHelpInfo[] DefaultExampleHelpInfos = + { + new MarkdownExampleHelpInfo("Example 1: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}"), + new MarkdownExampleHelpInfo("Example 2: {{ Add title here }}", $@"PS C:\> {{{{ Add code here }}}}{Environment.NewLine}{Environment.NewLine}{{{{ Add output here }}}}", @"{{ Add description here }}") + }; + + public static MarkdownParameterHelpInfo[] SupportsShouldProcessParameters = + { + new MarkdownParameterHelpInfo + { + Name = "Confirm", + Description ="Prompts you for confirmation before running the cmdlet.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "cf" } + }, + new MarkdownParameterHelpInfo + { + Name = "WhatIf", + Description ="Shows what would happen if the cmdlet runs. The cmdlet is not run.", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new [] { "wi" } + } + }; + + public static MarkdownParameterHelpInfo[] SupportsPagingParameters = + { + new MarkdownParameterHelpInfo + { + Name = "First", + Description ="Gets only the first 'n' objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "IncludeTotalCount", + Description ="Reports the number of objects in the data set (an integer) followed by the objects. If the cmdlet cannot determine the total count, it returns \"Unknown total count\".", + Type = typeof(SwitchParameter), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + }, + new MarkdownParameterHelpInfo + { + Name = "Skip", + Description ="Ignores the first 'n' objects and then gets the remaining objects.", + Type = typeof(ulong), + Position = "Named", + DefaultValue = "None", + HasAllParameterSets = true, + ParameterSetNames = new [] { "(All)" }, + Aliases = new string[0] + } + }; + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs new file mode 100644 index 000000000000..8b2c520c5407 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -0,0 +1,513 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Text; +using System.Text.RegularExpressions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class OutputTypeOutput + { + public PSTypeName[] OutputTypes { get; } + + public OutputTypeOutput(IEnumerable outputTypes) + { + OutputTypes = outputTypes.ToArray(); + } + + public override string ToString() => OutputTypes != null && OutputTypes.Any() ? $"[OutputType({OutputTypes.Select(ot => $"[{ot}]").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class CmdletBindingOutput + { + public VariantGroup VariantGroup { get; } + + public CmdletBindingOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() + { + var dpsText = VariantGroup.DefaultParameterSetName.IsValidDefaultParameterSetName() ? $"DefaultParameterSetName='{VariantGroup.DefaultParameterSetName}'" : String.Empty; + var sspText = VariantGroup.SupportsShouldProcess ? $"SupportsShouldProcess{ItemSeparator}ConfirmImpact='Medium'" : String.Empty; + var pbText = $"PositionalBinding={false.ToPsBool()}"; + var propertyText = new[] { dpsText, pbText, sspText }.JoinIgnoreEmpty(ItemSeparator); + return $"[CmdletBinding({propertyText})]{Environment.NewLine}"; + } + } + + internal class ParameterOutput + { + public Parameter Parameter { get; } + public bool HasMultipleVariantsInVariantGroup { get; } + public bool HasAllVariantsInParameterGroup { get; } + + public ParameterOutput(Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) + { + Parameter = parameter; + HasMultipleVariantsInVariantGroup = hasMultipleVariantsInVariantGroup; + HasAllVariantsInParameterGroup = hasAllVariantsInParameterGroup; + } + + public override string ToString() + { + var psnText = HasMultipleVariantsInVariantGroup && !HasAllVariantsInParameterGroup ? $"ParameterSetName='{Parameter.VariantName}'" : String.Empty; + var positionText = Parameter.Position != null ? $"Position={Parameter.Position}" : String.Empty; + var mandatoryText = Parameter.IsMandatory ? "Mandatory" : String.Empty; + var dontShowText = Parameter.DontShow ? "DontShow" : String.Empty; + var vfpText = Parameter.ValueFromPipeline ? "ValueFromPipeline" : String.Empty; + var vfpbpnText = Parameter.ValueFromPipelineByPropertyName ? "ValueFromPipelineByPropertyName" : String.Empty; + var propertyText = new[] { psnText, positionText, mandatoryText, dontShowText, vfpText, vfpbpnText }.JoinIgnoreEmpty(ItemSeparator); + return $"{Indent}[Parameter({propertyText})]{Environment.NewLine}"; + } + } + + internal class AliasOutput + { + public string[] Aliases { get; } + public bool IncludeIndent { get; } + + public AliasOutput(string[] aliases, bool includeIndent = false) + { + Aliases = aliases; + IncludeIndent = includeIndent; + } + + public override string ToString() => Aliases?.Any() ?? false ? $"{(IncludeIndent ? Indent : String.Empty)}[Alias({Aliases.Select(an => $"'{an}'").JoinIgnoreEmpty(ItemSeparator)})]{Environment.NewLine}" : String.Empty; + } + + internal class ValidateNotNullOutput + { + public bool HasValidateNotNull { get; } + + public ValidateNotNullOutput(bool hasValidateNotNull) + { + HasValidateNotNull = hasValidateNotNull; + } + + public override string ToString() => HasValidateNotNull ? $"{Indent}[ValidateNotNull()]{Environment.NewLine}" : String.Empty; + } + + internal class ArgumentCompleterOutput + { + public CompleterInfo CompleterInfo { get; } + + public ArgumentCompleterOutput(CompleterInfo completerInfo) + { + CompleterInfo = completerInfo; + } + + public override string ToString() => CompleterInfo != null + ? $"{Indent}[ArgumentCompleter({(CompleterInfo.IsTypeCompleter ? $"[{CompleterInfo.Type.Unwrap().ToPsType()}]" : $"{{{CompleterInfo.Script.ToPsSingleLine("; ")}}}")})]{Environment.NewLine}" + : String.Empty; + } + + internal class DefaultInfoOutput + { + public bool HasDefaultInfo { get; } + public DefaultInfo DefaultInfo { get; } + + public DefaultInfoOutput(ParameterGroup parameterGroup) + { + HasDefaultInfo = parameterGroup.HasDefaultInfo; + DefaultInfo = parameterGroup.DefaultInfo; + } + + public override string ToString() + { + var nameText = !String.IsNullOrEmpty(DefaultInfo?.Name) ? $"Name='{DefaultInfo?.Name}'" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(DefaultInfo?.Description) ? $"Description='{DefaultInfo?.Description.ToPsStringLiteral()}'" : String.Empty; + var scriptText = !String.IsNullOrEmpty(DefaultInfo?.Script) ? $"Script='{DefaultInfo?.Script.ToPsSingleLine("; ")}'" : String.Empty; + var propertyText = new[] { nameText, descriptionText, scriptText }.JoinIgnoreEmpty(ItemSeparator); + return HasDefaultInfo ? $"{Indent}[{typeof(DefaultInfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class ParameterTypeOutput + { + public Type ParameterType { get; } + + public ParameterTypeOutput(Type parameterType) + { + ParameterType = parameterType; + } + + public override string ToString() => $"{Indent}[{ParameterType.ToPsType()}]{Environment.NewLine}"; + } + + internal class ParameterNameOutput + { + public string ParameterName { get; } + public bool IsLast { get; } + + public ParameterNameOutput(string parameterName, bool isLast) + { + ParameterName = parameterName; + IsLast = isLast; + } + + public override string ToString() => $"{Indent}${{{ParameterName}}}{(IsLast ? String.Empty : $",{Environment.NewLine}")}{Environment.NewLine}"; + } + + internal class BeginOutput + { + public VariantGroup VariantGroup { get; } + + public BeginOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + } + + public override string ToString() => $@"begin {{ +{Indent}try {{ +{Indent}{Indent}$outBuffer = $null +{Indent}{Indent}if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) {{ +{Indent}{Indent}{Indent}$PSBoundParameters['OutBuffer'] = 1 +{Indent}{Indent}}} +{Indent}{Indent}$parameterSet = $PSCmdlet.ParameterSetName +{GetParameterSetToCmdletMapping()}{GetDefaultValuesStatements()} +{Indent}{Indent}$wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) +{Indent}{Indent}$scriptCmd = {{& $wrappedCmd @PSBoundParameters}} +{Indent}{Indent}$steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) +{Indent}{Indent}$steppablePipeline.Begin($PSCmdlet) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + + private string GetParameterSetToCmdletMapping() + { + var sb = new StringBuilder(); + sb.AppendLine($"{Indent}{Indent}$mapping = @{{"); + foreach (var variant in VariantGroup.Variants) + { + sb.AppendLine($@"{Indent}{Indent}{Indent}{variant.VariantName} = '{variant.PrivateModuleName}\{variant.PrivateCmdletName}';"); + } + sb.Append($"{Indent}{Indent}}}"); + return sb.ToString(); + } + + private string GetDefaultValuesStatements() + { + var defaultInfos = VariantGroup.ParameterGroups.Where(pg => pg.HasDefaultInfo).Select(pg => pg.DefaultInfo).ToArray(); + var sb = new StringBuilder(); + + foreach (var defaultInfo in defaultInfos) + { + var variantListString = defaultInfo.ParameterGroup.VariantNames.ToPsList(); + var parameterName = defaultInfo.ParameterGroup.ParameterName; + sb.AppendLine(); + sb.AppendLine($"{Indent}{Indent}if (({variantListString}) -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('{parameterName}')) {{"); + sb.AppendLine($"{Indent}{Indent}{Indent}$PSBoundParameters['{parameterName}'] = {defaultInfo.Script}"); + sb.Append($"{Indent}{Indent}}}"); + } + return sb.ToString(); + } + } + + internal class ProcessOutput + { + public override string ToString() => $@"process {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.Process($_) +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} + +"; + } + + internal class EndOutput + { + public override string ToString() => $@"end {{ +{Indent}try {{ +{Indent}{Indent}$steppablePipeline.End() +{Indent}}} catch {{ +{Indent}{Indent}throw +{Indent}}} +}} +"; + } + + internal class HelpCommentOutput + { + public VariantGroup VariantGroup { get; } + public CommentInfo CommentInfo { get; } + + public HelpCommentOutput(VariantGroup variantGroup) + { + VariantGroup = variantGroup; + CommentInfo = variantGroup.CommentInfo; + } + + public override string ToString() + { + var inputs = String.Join(Environment.NewLine, CommentInfo.Inputs.Select(i => $".Inputs{Environment.NewLine}{i}")); + var inputsText = !String.IsNullOrEmpty(inputs) ? $"{Environment.NewLine}{inputs}" : String.Empty; + var outputs = String.Join(Environment.NewLine, CommentInfo.Outputs.Select(o => $".Outputs{Environment.NewLine}{o}")); + var outputsText = !String.IsNullOrEmpty(outputs) ? $"{Environment.NewLine}{outputs}" : String.Empty; + var notes = String.Join($"{Environment.NewLine}{Environment.NewLine}", VariantGroup.ComplexInterfaceInfos.Select(cii => cii.ToNoteOutput())); + var notesText = !String.IsNullOrEmpty(notes) ? $"{Environment.NewLine}.Notes{Environment.NewLine}{ComplexParameterHeader}{notes}" : String.Empty; + var relatedLinks = String.Join(Environment.NewLine, CommentInfo.RelatedLinks.Select(l => $".Link{Environment.NewLine}{l}")); + var relatedLinksText = !String.IsNullOrEmpty(relatedLinks) ? $"{Environment.NewLine}{relatedLinks}" : String.Empty; + var examples = ""; + foreach (var example in VariantGroup.HelpInfo.Examples) + { + examples = examples + ".Example" + "\r\n" + example.Code + "\r\n"; + } + return $@"<# +.Synopsis +{CommentInfo.Synopsis.ToDescriptionFormat(false)} +.Description +{CommentInfo.Description.ToDescriptionFormat(false)} +{examples}{inputsText}{outputsText}{notesText} +.Link +{CommentInfo.OnlineVersion}{relatedLinksText} +#> +"; + } + } + + internal class ParameterDescriptionOutput + { + public string Description { get; } + + public ParameterDescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) + ? Description.ToDescriptionFormat(false).NormalizeNewLines() + .Split(new [] { Environment.NewLine }, StringSplitOptions.None) + .Aggregate(String.Empty, (c, n) => c + $"{Indent}# {n}{Environment.NewLine}") + : String.Empty; + } + + internal class ProfileOutput + { + public string ProfileName { get; } + + public ProfileOutput(string profileName) + { + ProfileName = profileName; + } + + public override string ToString() => ProfileName != NoProfiles ? $"[{typeof(ProfileAttribute).ToPsAttributeType()}('{ProfileName}')]{Environment.NewLine}" : String.Empty; + } + + internal class DescriptionOutput + { + public string Description { get; } + + public DescriptionOutput(string description) + { + Description = description; + } + + public override string ToString() => !String.IsNullOrEmpty(Description) ? $"[{typeof(DescriptionAttribute).ToPsAttributeType()}('{Description.ToPsStringLiteral()}')]{Environment.NewLine}" : String.Empty; + } + + internal class ParameterCategoryOutput + { + public ParameterCategory Category { get; } + + public ParameterCategoryOutput(ParameterCategory category) + { + Category = category; + } + + public override string ToString() => $"{Indent}[{typeof(CategoryAttribute).ToPsAttributeType()}('{Category}')]{Environment.NewLine}"; + } + + internal class InfoOutput + { + public InfoAttribute Info { get; } + public Type ParameterType { get; } + + public InfoOutput(InfoAttribute info, Type parameterType) + { + Info = info; + ParameterType = parameterType; + } + + public override string ToString() + { + // Rendering of InfoAttribute members that are not used currently + /*var serializedNameText = Info.SerializedName != null ? $"SerializedName='{Info.SerializedName}'" : String.Empty; + var readOnlyText = Info.ReadOnly ? "ReadOnly" : String.Empty; + var descriptionText = !String.IsNullOrEmpty(Info.Description) ? $"Description='{Info.Description.ToPsStringLiteral()}'" : String.Empty;*/ + + var requiredText = Info.Required ? "Required" : String.Empty; + var unwrappedType = ParameterType.Unwrap(); + var hasValidPossibleTypes = Info.PossibleTypes.Any(pt => pt != unwrappedType); + var possibleTypesText = hasValidPossibleTypes + ? $"PossibleTypes=({Info.PossibleTypes.Select(pt => $"[{pt.ToPsType()}]").JoinIgnoreEmpty(ItemSeparator)})" + : String.Empty; + var propertyText = new[] { /*serializedNameText, */requiredText,/* readOnlyText,*/ possibleTypesText/*, descriptionText*/ }.JoinIgnoreEmpty(ItemSeparator); + return hasValidPossibleTypes ? $"{Indent}[{typeof(InfoAttribute).ToPsAttributeType()}({propertyText})]{Environment.NewLine}" : String.Empty; + } + } + + internal class PropertySyntaxOutput + { + public string ParameterName { get; } + public Type ParameterType { get; } + public bool IsMandatory { get; } + public int? Position { get; } + + public bool IncludeSpace { get; } + public bool IncludeDash { get; } + + public PropertySyntaxOutput(Parameter parameter) + { + ParameterName = parameter.ParameterName; + ParameterType = parameter.ParameterType; + IsMandatory = parameter.IsMandatory; + Position = parameter.Position; + IncludeSpace = true; + IncludeDash = true; + } + + public PropertySyntaxOutput(ComplexInterfaceInfo complexInterfaceInfo) + { + ParameterName = complexInterfaceInfo.Name; + ParameterType = complexInterfaceInfo.Type; + IsMandatory = complexInterfaceInfo.Required; + Position = null; + IncludeSpace = false; + IncludeDash = false; + } + + public override string ToString() + { + var leftOptional = !IsMandatory ? "[" : String.Empty; + var leftPositional = Position != null ? "[" : String.Empty; + var rightPositional = Position != null ? "]" : String.Empty; + var type = ParameterType != typeof(SwitchParameter) ? $" <{ParameterType.ToSyntaxTypeName()}>" : String.Empty; + var rightOptional = !IsMandatory ? "]" : String.Empty; + var space = IncludeSpace ? " " : String.Empty; + var dash = IncludeDash ? "-" : String.Empty; + return $"{space}{leftOptional}{leftPositional}{dash}{ParameterName}{rightPositional}{type}{rightOptional}"; + } + } + + internal static class PsProxyOutputExtensions + { + public const string NoParameters = "__NoParameters"; + + public const string AllParameterSets = "__AllParameterSets"; + + public const string HalfIndent = " "; + + public const string Indent = HalfIndent + HalfIndent; + + public const string ItemSeparator = ", "; + + public static readonly string ComplexParameterHeader = $"COMPLEX PARAMETER PROPERTIES{Environment.NewLine}{Environment.NewLine}To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables.{Environment.NewLine}{Environment.NewLine}"; + + public static string ToPsBool(this bool value) => $"${value.ToString().ToLowerInvariant()}"; + + public static string ToPsType(this Type type) + { + var regex = new Regex(@"^(.*)`{1}\d+(.*)$"); + var typeText = type.ToString(); + var match = regex.Match(typeText); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : typeText; + } + + public static string ToPsAttributeType(this Type type) => type.ToPsType().RemoveEnd("Attribute"); + + // https://stackoverflow.com/a/5284606/294804 + private static string RemoveEnd(this string text, string suffix) => text.EndsWith(suffix) ? text.Substring(0, text.Length - suffix.Length) : text; + + public static string ToPsSingleLine(this string value, string replacer = " ") => value.ReplaceNewLines(replacer, new []{"
", "\r\n", "\n"}); + + public static string ToPsStringLiteral(this string value) => value?.Replace("'", "''").Replace("‘", "''").Replace("’", "''").ToPsSingleLine().Trim() ?? String.Empty; + + public static string JoinIgnoreEmpty(this IEnumerable values, string separator) => String.Join(separator, values?.Where(v => !String.IsNullOrEmpty(v))); + + // https://stackoverflow.com/a/41961738/294804 + public static string ToSyntaxTypeName(this Type type) + { + if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>)) + { + return $"{type.GetGenericArguments().First().ToSyntaxTypeName()}?"; + } + + if (type.IsGenericType) + { + var genericTypes = String.Join(ItemSeparator, type.GetGenericArguments().Select(ToSyntaxTypeName)); + return $"{type.Name.Split('`').First()}<{genericTypes}>"; + } + + return type.Name; + } + + public static OutputTypeOutput ToOutputTypeOutput(this IEnumerable outputTypes) => new OutputTypeOutput(outputTypes); + + public static CmdletBindingOutput ToCmdletBindingOutput(this VariantGroup variantGroup) => new CmdletBindingOutput(variantGroup); + + public static ParameterOutput ToParameterOutput(this Parameter parameter, bool hasMultipleVariantsInVariantGroup, bool hasAllVariantsInParameterGroup) => new ParameterOutput(parameter, hasMultipleVariantsInVariantGroup, hasAllVariantsInParameterGroup); + + public static AliasOutput ToAliasOutput(this string[] aliases, bool includeIndent = false) => new AliasOutput(aliases, includeIndent); + + public static ValidateNotNullOutput ToValidateNotNullOutput(this bool hasValidateNotNull) => new ValidateNotNullOutput(hasValidateNotNull); + + public static ArgumentCompleterOutput ToArgumentCompleterOutput(this CompleterInfo completerInfo) => new ArgumentCompleterOutput(completerInfo); + + public static DefaultInfoOutput ToDefaultInfoOutput(this ParameterGroup parameterGroup) => new DefaultInfoOutput(parameterGroup); + + public static ParameterTypeOutput ToParameterTypeOutput(this Type parameterType) => new ParameterTypeOutput(parameterType); + + public static ParameterNameOutput ToParameterNameOutput(this string parameterName, bool isLast) => new ParameterNameOutput(parameterName, isLast); + + public static BeginOutput ToBeginOutput(this VariantGroup variantGroup) => new BeginOutput(variantGroup); + + public static ProcessOutput ToProcessOutput(this VariantGroup variantGroup) => new ProcessOutput(); + + public static EndOutput ToEndOutput(this VariantGroup variantGroup) => new EndOutput(); + + public static HelpCommentOutput ToHelpCommentOutput(this VariantGroup variantGroup) => new HelpCommentOutput(variantGroup); + + public static ParameterDescriptionOutput ToParameterDescriptionOutput(this string description) => new ParameterDescriptionOutput(description); + + public static ProfileOutput ToProfileOutput(this string profileName) => new ProfileOutput(profileName); + + public static DescriptionOutput ToDescriptionOutput(this string description) => new DescriptionOutput(description); + + public static ParameterCategoryOutput ToParameterCategoryOutput(this ParameterCategory category) => new ParameterCategoryOutput(category); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this Parameter parameter) => new PropertySyntaxOutput(parameter); + + public static PropertySyntaxOutput ToPropertySyntaxOutput(this ComplexInterfaceInfo complexInterfaceInfo) => new PropertySyntaxOutput(complexInterfaceInfo); + + public static InfoOutput ToInfoOutput(this InfoAttribute info, Type parameterType) => new InfoOutput(info, parameterType); + + public static string ToNoteOutput(this ComplexInterfaceInfo complexInterfaceInfo, string currentIndent = "", bool includeDashes = false, bool includeBackticks = false, bool isFirst = true) + { + string RenderProperty(ComplexInterfaceInfo info, string indent, bool dash, bool backtick) => + $"{indent}{(dash ? "- " : String.Empty)}{(backtick ? "`" : String.Empty)}{info.ToPropertySyntaxOutput()}{(backtick ? "`" : String.Empty)}: {info.Description}"; + + var nested = complexInterfaceInfo.NestedInfos.Select(ni => + { + var nestedIndent = $"{currentIndent}{HalfIndent}"; + return ni.IsComplexInterface + ? ni.ToNoteOutput(nestedIndent, includeDashes, includeBackticks, false) + : RenderProperty(ni, nestedIndent, includeDashes, includeBackticks); + }).Prepend(RenderProperty(complexInterfaceInfo, currentIndent, !isFirst && includeDashes, !isFirst && includeBackticks)); + return String.Join(Environment.NewLine, nested); + } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs new file mode 100644 index 000000000000..1311e5e69110 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -0,0 +1,499 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using System.Reflection; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyOutputExtensions; +using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell.PsProxyTypeExtensions; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal class ProfileGroup + { + public string ProfileName { get; } + public Variant[] Variants { get; } + public string ProfileFolder { get; } + + public ProfileGroup(Variant[] variants, string profileName = NoProfiles) + { + ProfileName = profileName; + Variants = variants; + ProfileFolder = ProfileName != NoProfiles ? ProfileName : String.Empty; + } + } + + internal class VariantGroup + { + public string ModuleName { get; } + public string CmdletName { get; } + public string CmdletVerb { get; } + public string CmdletNoun { get; } + public string ProfileName { get; } + public Variant[] Variants { get; } + public ParameterGroup[] ParameterGroups { get; } + public ComplexInterfaceInfo[] ComplexInterfaceInfos { get; } + + public string[] Aliases { get; } + public PSTypeName[] OutputTypes { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + public string DefaultParameterSetName { get; } + public bool HasMultipleVariants { get; } + public PsHelpInfo HelpInfo { get; } + public bool IsGenerated { get; } + public bool IsInternal { get; } + + public string OutputFolder { get; } + public string FileName { get; } + public string FilePath { get; } + + public CommentInfo CommentInfo { get; } + + public VariantGroup(string moduleName, string cmdletName, Variant[] variants, string outputFolder, string profileName = NoProfiles, bool isTest = false, bool isInternal = false) + { + ModuleName = moduleName; + CmdletName = cmdletName; + var cmdletNameParts = CmdletName.Split('-'); + CmdletVerb = cmdletNameParts.First(); + CmdletNoun = cmdletNameParts.Last(); + ProfileName = profileName; + Variants = variants; + ParameterGroups = Variants.ToParameterGroups().OrderBy(pg => pg.OrderCategory).ThenByDescending(pg => pg.IsMandatory).ToArray(); + var aliasDuplicates = ParameterGroups.SelectMany(pg => pg.Aliases) + //https://stackoverflow.com/a/18547390/294804 + .GroupBy(a => a).Where(g => g.Count() > 1).Select(g => g.Key).ToArray(); + if (aliasDuplicates.Any()) + { + throw new ParsingMetadataException($"The alias(es) [{String.Join(", ", aliasDuplicates)}] are defined on multiple parameters for cmdlet '{CmdletName}', which is not supported."); + } + ComplexInterfaceInfos = ParameterGroups.Where(pg => !pg.DontShow && pg.IsComplexInterface).OrderBy(pg => pg.ParameterName).Select(pg => pg.ComplexInterfaceInfo).ToArray(); + + Aliases = Variants.SelectMany(v => v.Attributes).ToAliasNames().ToArray(); + OutputTypes = Variants.SelectMany(v => v.Info.OutputType).Where(ot => ot.Type != null).GroupBy(ot => ot.Type).Select(otg => otg.First()).ToArray(); + SupportsShouldProcess = Variants.Any(v => v.SupportsShouldProcess); + SupportsPaging = Variants.Any(v => v.SupportsPaging); + DefaultParameterSetName = DetermineDefaultParameterSetName(); + HasMultipleVariants = Variants.Length > 1; + HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); + IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); + IsInternal = isInternal; + + OutputFolder = outputFolder; + FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; + FilePath = Path.Combine(OutputFolder, FileName); + + CommentInfo = new CommentInfo(this); + } + + private string DetermineDefaultParameterSetName() + { + var defaultParameterSet = Variants + .Select(v => v.Metadata.DefaultParameterSetName) + .LastOrDefault(dpsn => dpsn.IsValidDefaultParameterSetName()); + + if (String.IsNullOrEmpty(defaultParameterSet)) + { + var variantParamCountGroups = Variants + .Select(v => ( + variant: v.VariantName, + paramCount: v.CmdletOnlyParameters.Count(p => p.IsMandatory), + isSimple: v.CmdletOnlyParameters.Where(p => p.IsMandatory).All(p => p.ParameterType.IsPsSimple()))) + .GroupBy(vpc => vpc.isSimple) + .ToArray(); + var variantParameterCounts = (variantParamCountGroups.Any(g => g.Key) ? variantParamCountGroups.Where(g => g.Key) : variantParamCountGroups).SelectMany(g => g).ToArray(); + var smallestParameterCount = variantParameterCounts.Min(vpc => vpc.paramCount); + defaultParameterSet = variantParameterCounts.First(vpc => vpc.paramCount == smallestParameterCount).variant; + } + + return defaultParameterSet; + } + } + + internal class Variant + { + public string CmdletName { get; } + public string VariantName { get; } + public CommandInfo Info { get; } + public CommandMetadata Metadata { get; } + public PsHelpInfo HelpInfo { get; } + public bool HasParameterSets { get; } + public bool IsFunction { get; } + public string PrivateModuleName { get; } + public string PrivateCmdletName { get; } + public bool SupportsShouldProcess { get; } + public bool SupportsPaging { get; } + + public Attribute[] Attributes { get; } + public Parameter[] Parameters { get; } + public Parameter[] CmdletOnlyParameters { get; } + public bool IsInternal { get; } + public bool IsDoNotExport { get; } + public string[] Profiles { get; } + + public Variant(string cmdletName, string variantName, CommandInfo info, CommandMetadata metadata, bool hasParameterSets = false, PsHelpInfo helpInfo = null) + { + CmdletName = cmdletName; + VariantName = variantName; + Info = info; + HelpInfo = helpInfo ?? new PsHelpInfo(); + Metadata = metadata; + HasParameterSets = hasParameterSets; + IsFunction = Info.CommandType == CommandTypes.Function; + PrivateModuleName = Info.Source; + PrivateCmdletName = Metadata.Name; + SupportsShouldProcess = Metadata.SupportsShouldProcess; + SupportsPaging = Metadata.SupportsPaging; + + Attributes = this.ToAttributes(); + Parameters = this.ToParameters().OrderBy(p => p.OrderCategory).ThenByDescending(p => p.IsMandatory).ToArray(); + IsInternal = Attributes.OfType().Any(); + IsDoNotExport = Attributes.OfType().Any(); + CmdletOnlyParameters = Parameters.Where(p => !p.Categories.Any(c => c == ParameterCategory.Azure || c == ParameterCategory.Runtime)).ToArray(); + Profiles = Attributes.OfType().SelectMany(pa => pa.Profiles).ToArray(); + } + } + + internal class ParameterGroup + { + public string ParameterName { get; } + public Parameter[] Parameters { get; } + + public string[] VariantNames { get; } + public string[] AllVariantNames { get; } + public bool HasAllVariants { get; } + public Type ParameterType { get; } + public string Description { get; } + + public string[] Aliases { get; } + public bool HasValidateNotNull { get; } + public CompleterInfo CompleterInfo { get; } + public DefaultInfo DefaultInfo { get; } + public bool HasDefaultInfo { get; } + public ParameterCategory OrderCategory { get; } + public bool DontShow { get; } + public bool IsMandatory { get; } + public bool SupportsWildcards { get; } + public bool IsComplexInterface { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public InfoAttribute InfoAttribute { get; } + + public int? FirstPosition { get; } + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public bool IsInputType { get; } + + public ParameterGroup(string parameterName, Parameter[] parameters, string[] allVariantNames) + { + ParameterName = parameterName; + Parameters = parameters; + + VariantNames = Parameters.Select(p => p.VariantName).ToArray(); + AllVariantNames = allVariantNames; + HasAllVariants = VariantNames.Any(vn => vn == AllParameterSets) || !AllVariantNames.Except(VariantNames).Any(); + var types = Parameters.Select(p => p.ParameterType).Distinct().ToArray(); + if (types.Length > 1) + { + throw new ParsingMetadataException($"The parameter '{ParameterName}' has multiple parameter types [{String.Join(", ", types.Select(t => t.Name))}] defined, which is not supported."); + } + ParameterType = types.First(); + Description = Parameters.Select(p => p.Description).FirstOrDefault(d => !String.IsNullOrEmpty(d)).EmptyIfNull(); + + Aliases = Parameters.SelectMany(p => p.Attributes).ToAliasNames().ToArray(); + HasValidateNotNull = Parameters.SelectMany(p => p.Attributes.OfType()).Any(); + CompleterInfo = Parameters.Select(p => p.CompleterInfoAttribute).FirstOrDefault()?.ToCompleterInfo() + ?? Parameters.Select(p => p.ArgumentCompleterAttribute).FirstOrDefault()?.ToCompleterInfo(); + DefaultInfo = Parameters.Select(p => p.DefaultInfoAttribute).FirstOrDefault()?.ToDefaultInfo(this) + ?? Parameters.Select(p => p.DefaultValueAttribute).FirstOrDefault(dv => dv != null)?.ToDefaultInfo(this); + HasDefaultInfo = DefaultInfo != null && !String.IsNullOrEmpty(DefaultInfo.Script); + // When DefaultInfo is present, force all parameters from this group to be optional. + if (HasDefaultInfo) + { + foreach (var parameter in Parameters) + { + parameter.IsMandatory = false; + } + } + OrderCategory = Parameters.Select(p => p.OrderCategory).Distinct().DefaultIfEmpty(ParameterCategory.Body).Min(); + DontShow = Parameters.All(p => p.DontShow); + IsMandatory = HasAllVariants && Parameters.Any(p => p.IsMandatory); + SupportsWildcards = Parameters.Any(p => p.SupportsWildcards); + IsComplexInterface = Parameters.Any(p => p.IsComplexInterface); + ComplexInterfaceInfo = Parameters.Where(p => p.IsComplexInterface).Select(p => p.ComplexInterfaceInfo).FirstOrDefault(); + InfoAttribute = Parameters.Select(p => p.InfoAttribute).First(); + + FirstPosition = Parameters.Select(p => p.Position).FirstOrDefault(p => p != null); + ValueFromPipeline = Parameters.Any(p => p.ValueFromPipeline); + ValueFromPipelineByPropertyName = Parameters.Any(p => p.ValueFromPipelineByPropertyName); + IsInputType = ValueFromPipeline || ValueFromPipelineByPropertyName; + } + } + + internal class Parameter + { + public string VariantName { get; } + public string ParameterName { get; } + public ParameterMetadata Metadata { get; } + public PsParameterHelpInfo HelpInfo { get; } + public Type ParameterType { get; } + + public Attribute[] Attributes { get; } + public ParameterCategory[] Categories { get; } + public ParameterCategory OrderCategory { get; } + public PSDefaultValueAttribute DefaultValueAttribute { get; } + public DefaultInfoAttribute DefaultInfoAttribute { get; } + public ParameterAttribute ParameterAttribute { get; } + public bool SupportsWildcards { get; } + public CompleterInfoAttribute CompleterInfoAttribute { get; } + public ArgumentCompleterAttribute ArgumentCompleterAttribute { get; } + + public bool ValueFromPipeline { get; } + public bool ValueFromPipelineByPropertyName { get; } + public int? Position { get; } + public bool DontShow { get; } + public bool IsMandatory { get; set; } + + public InfoAttribute InfoAttribute { get; } + public ComplexInterfaceInfo ComplexInterfaceInfo { get; } + public bool IsComplexInterface { get; } + public string Description { get; } + + public Parameter(string variantName, string parameterName, ParameterMetadata metadata, PsParameterHelpInfo helpInfo = null) + { + VariantName = variantName; + ParameterName = parameterName; + Metadata = metadata; + HelpInfo = helpInfo ?? new PsParameterHelpInfo(); + + Attributes = Metadata.Attributes.ToArray(); + ParameterType = Attributes.OfType().FirstOrDefault()?.Type ?? Metadata.ParameterType; + Categories = Attributes.OfType().SelectMany(ca => ca.Categories).Distinct().ToArray(); + OrderCategory = Categories.DefaultIfEmpty(ParameterCategory.Body).Min(); + DefaultValueAttribute = Attributes.OfType().FirstOrDefault(); + DefaultInfoAttribute = Attributes.OfType().FirstOrDefault(); + ParameterAttribute = Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == VariantName || pa.ParameterSetName == AllParameterSets); + if (ParameterAttribute == null) + { + throw new ParsingMetadataException($"The variant '{VariantName}' has multiple parameter sets defined, which is not supported."); + } + SupportsWildcards = Attributes.OfType().Any(); + CompleterInfoAttribute = Attributes.OfType().FirstOrDefault(); + ArgumentCompleterAttribute = Attributes.OfType().FirstOrDefault(); + + ValueFromPipeline = ParameterAttribute.ValueFromPipeline; + ValueFromPipelineByPropertyName = ParameterAttribute.ValueFromPipelineByPropertyName; + Position = ParameterAttribute.Position == Int32.MinValue ? (int?)null : ParameterAttribute.Position; + DontShow = ParameterAttribute.DontShow; + IsMandatory = ParameterAttribute.Mandatory; + + var complexParameterName = ParameterName.ToUpperInvariant(); + var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; + // Remove the complex type message as it will be reinserted if this is a complex type + description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + // Make an InfoAttribute for processing only if one isn't provided + InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; + // Set the description if the InfoAttribute does not have one since they are exported without a description + InfoAttribute.Description = String.IsNullOrEmpty(InfoAttribute.Description) ? description : InfoAttribute.Description; + ComplexInterfaceInfo = InfoAttribute.ToComplexInterfaceInfo(complexParameterName, ParameterType, true); + IsComplexInterface = ComplexInterfaceInfo.IsComplexInterface; + Description = $"{description}{(IsComplexInterface ? complexMessage : String.Empty)}"; + } + } + + internal class ComplexInterfaceInfo + { + public InfoAttribute InfoAttribute { get; } + + public string Name { get; } + public Type Type { get; } + public bool Required { get; } + public bool ReadOnly { get; } + public string Description { get; } + + public ComplexInterfaceInfo[] NestedInfos { get; } + public bool IsComplexInterface { get; } + + public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, bool? required, List seenTypes) + { + Name = name; + Type = type; + InfoAttribute = infoAttribute; + + Required = required ?? InfoAttribute.Required; + ReadOnly = InfoAttribute.ReadOnly; + Description = InfoAttribute.Description.ToPsSingleLine(); + + var unwrappedType = Type.Unwrap(); + var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; + (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + unwrappedType.GetInterfaces() + .Concat(InfoAttribute.PossibleTypes) + .SelectMany(pt => pt.GetProperties() + .SelectMany(pi => pi.GetCustomAttributes(true).OfType() + .Select(ia => ia.ToComplexInterfaceInfo(pi.Name, pi.PropertyType, seenTypes: seenTypes)))) + .Where(cii => !cii.ReadOnly).OrderByDescending(cii => cii.Required).ToArray(); + // https://stackoverflow.com/a/503359/294804 + var associativeArrayInnerType = Type.GetInterfaces() + .FirstOrDefault(i => i.IsGenericType && i.GetGenericTypeDefinition() == typeof(IAssociativeArray<>)) + ?.GetTypeInfo().GetGenericArguments().First(); + if (!hasBeenSeen && associativeArrayInnerType != null) + { + var anyInfo = new InfoAttribute { Description = "This indicates any property can be added to this object." }; + NestedInfos = NestedInfos.Prepend(anyInfo.ToComplexInterfaceInfo("(Any)", associativeArrayInnerType)).ToArray(); + } + IsComplexInterface = NestedInfos.Any(); + } + } + + internal class CommentInfo + { + public string Description { get; } + public string Synopsis { get; } + + public string[] Examples { get; } + public string[] Inputs { get; } + public string[] Outputs { get; } + + public string OnlineVersion { get; } + public string[] RelatedLinks { get; } + + private const string HelpLinkPrefix = @"https://docs.microsoft.com/en-us/powershell/module/"; + + public CommentInfo(VariantGroup variantGroup) + { + var helpInfo = variantGroup.HelpInfo; + Description = variantGroup.Variants.SelectMany(v => v.Attributes).OfType().FirstOrDefault()?.Description.NullIfEmpty() + ?? helpInfo.Description.EmptyIfNull(); + // If there is no Synopsis, PowerShell may put in the Syntax string as the Synopsis. This seems unintended, so we remove the Synopsis in this situation. + var synopsis = helpInfo.Synopsis.EmptyIfNull().Trim().StartsWith(variantGroup.CmdletName) ? String.Empty : helpInfo.Synopsis; + Synopsis = synopsis.NullIfEmpty() ?? Description; + + Examples = helpInfo.Examples.Select(rl => rl.Code).ToArray(); + + Inputs = (variantGroup.ParameterGroups.Where(pg => pg.IsInputType).Select(pg => pg.ParameterType.FullName).ToArray().NullIfEmpty() ?? + helpInfo.InputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(it => it.Name).ToArray()) + .Where(i => i != "None").Distinct().OrderBy(i => i).ToArray(); + Outputs = (variantGroup.OutputTypes.Select(ot => ot.Type.FullName).ToArray().NullIfEmpty() ?? + helpInfo.OutputTypes.Where(it => it.Name.NullIfWhiteSpace() != null).Select(ot => ot.Name).ToArray()) + .Where(o => o != "None").Distinct().OrderBy(o => o).ToArray(); + + OnlineVersion = helpInfo.OnlineVersion?.Uri.NullIfEmpty() ?? $@"{HelpLinkPrefix}{variantGroup.ModuleName.ToLowerInvariant()}/{variantGroup.CmdletName.ToLowerInvariant()}"; + RelatedLinks = helpInfo.RelatedLinks.Select(rl => rl.Text).ToArray(); + } + } + + internal class CompleterInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public Type Type { get; } + public bool IsTypeCompleter { get; } + + public CompleterInfo(CompleterInfoAttribute infoAttribute) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + } + + public CompleterInfo(ArgumentCompleterAttribute completerAttribute) + { + Script = completerAttribute.ScriptBlock?.ToString(); + if (completerAttribute.Type != null) + { + Type = completerAttribute.Type; + IsTypeCompleter = true; + } + } + } + + internal class DefaultInfo + { + public string Name { get; } + public string Description { get; } + public string Script { get; } + public ParameterGroup ParameterGroup { get; } + + public DefaultInfo(DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) + { + Name = infoAttribute.Name; + Description = infoAttribute.Description; + Script = infoAttribute.Script; + ParameterGroup = parameterGroup; + } + + public DefaultInfo(PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) + { + Description = defaultValueAttribute.Help; + ParameterGroup = parameterGroup; + if (defaultValueAttribute.Value != null) + { + Script = defaultValueAttribute.Value.ToString(); + } + } + } + + internal static class PsProxyTypeExtensions + { + public const string NoProfiles = "__NoProfiles"; + + public static bool IsValidDefaultParameterSetName(this string parameterSetName) => + !String.IsNullOrEmpty(parameterSetName) && parameterSetName != AllParameterSets; + + public static Variant[] ToVariants(this CommandInfo info, PsHelpInfo helpInfo) + { + var metadata = new CommandMetadata(info); + var privateCmdletName = metadata.Name.Split('!').First(); + var parts = privateCmdletName.Split('_'); + return parts.Length > 1 + ? new[] { new Variant(parts[0], parts[1], info, metadata, helpInfo: helpInfo) } + // Process multiple parameter sets, so we declare a variant per parameter set. + : info.ParameterSets.Select(ps => new Variant(privateCmdletName, ps.Name, info, metadata, true, helpInfo)).ToArray(); + } + + public static Variant[] ToVariants(this CmdletAndHelpInfo info) => info.CommandInfo.ToVariants(info.HelpInfo); + + public static Variant[] ToVariants(this CommandInfo info, PSObject helpInfo = null) => info.ToVariants(helpInfo?.ToPsHelpInfo()); + + public static Parameter[] ToParameters(this Variant variant) + { + var parameters = variant.Metadata.Parameters.AsEnumerable(); + var parameterHelp = variant.HelpInfo.Parameters.AsEnumerable(); + if (variant.HasParameterSets) + { + parameters = parameters.Where(p => p.Value.ParameterSets.Keys.Any(k => k == variant.VariantName || k == AllParameterSets)); + parameterHelp = parameterHelp.Where(ph => !ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)); + } + return parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))).ToArray(); + } + + public static Attribute[] ToAttributes(this Variant variant) => variant.IsFunction + ? ((FunctionInfo)variant.Info).ScriptBlock.Attributes.ToArray() + : variant.Metadata.CommandType.GetCustomAttributes(false).Cast().ToArray(); + + public static IEnumerable ToParameterGroups(this Variant[] variants) + { + var allVariantNames = variants.Select(vg => vg.VariantName).ToArray(); + return variants + .SelectMany(v => v.Parameters) + .GroupBy(p => p.ParameterName, StringComparer.InvariantCultureIgnoreCase) + .Select(pg => new ParameterGroup(pg.Key, pg.Select(p => p).ToArray(), allVariantNames)); + } + + public static ComplexInterfaceInfo ToComplexInterfaceInfo(this InfoAttribute infoAttribute, string name, Type type, bool? required = null, List seenTypes = null) + => new ComplexInterfaceInfo(name, type, infoAttribute, required, seenTypes); + + public static CompleterInfo ToCompleterInfo(this CompleterInfoAttribute infoAttribute) => new CompleterInfo(infoAttribute); + public static CompleterInfo ToCompleterInfo(this ArgumentCompleterAttribute completerAttribute) => new CompleterInfo(completerAttribute); + + public static DefaultInfo ToDefaultInfo(this DefaultInfoAttribute infoAttribute, ParameterGroup parameterGroup) => new DefaultInfo(infoAttribute, parameterGroup); + public static DefaultInfo ToDefaultInfo(this PSDefaultValueAttribute defaultValueAttribute, ParameterGroup parameterGroup) => new DefaultInfo(defaultValueAttribute, parameterGroup); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs b/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs new file mode 100644 index 000000000000..532c2eb6e10f --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsAttributes.cs @@ -0,0 +1,114 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain +{ + [AttributeUsage(AttributeTargets.Class)] + public class DescriptionAttribute : Attribute + { + public string Description { get; } + + public DescriptionAttribute(string description) + { + Description = description; + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class DoNotExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class InternalExportAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class GeneratedAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property)] + public class DoNotFormatAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Class)] + public class ProfileAttribute : Attribute + { + public string[] Profiles { get; } + + public ProfileAttribute(params string[] profiles) + { + Profiles = profiles; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class CategoryAttribute : Attribute + { + public ParameterCategory[] Categories { get; } + + public CategoryAttribute(params ParameterCategory[] categories) + { + Categories = categories; + } + } + + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] + public class ExportAsAttribute : Attribute + { + public Type Type { get; set; } + + public ExportAsAttribute(Type type) + { + Type = type; + } + } + + public enum ParameterCategory + { + // Note: Order is significant + Uri = 0, + Path, + Query, + Header, + Cookie, + Body, + Azure, + Runtime + } + + [AttributeUsage(AttributeTargets.Property)] + public class OriginAttribute : Attribute + { + public PropertyOrigin Origin { get; } + + public OriginAttribute(PropertyOrigin origin) + { + Origin = origin; + } + } + + public enum PropertyOrigin + { + // Note: Order is significant + Inherited = 0, + Owned, + Inlined + } + + [AttributeUsage(AttributeTargets.Property)] + public class FormatTableAttribute : Attribute + { + public int Index { get; set; } = -1; + public bool HasIndex => Index != -1; + public string Label { get; set; } + public int Width { get; set; } = -1; + public bool HasWidth => Width != -1; + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs new file mode 100644 index 000000000000..df134e8ba5e1 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsExtensions.cs @@ -0,0 +1,160 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Management.Automation; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class PsExtensions + { + // https://stackoverflow.com/a/863944/294804 + // https://stackoverflow.com/a/4452598/294804 + // https://stackoverflow.com/a/28701974/294804 + // Note: This will unwrap nested collections, but we don't generate nested collections. + public static Type Unwrap(this Type type) + { + if (type.IsArray) + { + return type.GetElementType().Unwrap(); + } + + var typeInfo = type.GetTypeInfo(); + if (typeInfo.IsGenericType + && (typeInfo.GetGenericTypeDefinition() == typeof(Nullable<>) || typeof(IEnumerable<>).IsAssignableFrom(type))) + { + return typeInfo.GetGenericArguments().First().Unwrap(); + } + + return type; + } + + // https://stackoverflow.com/a/863944/294804 + private static bool IsSimple(this Type type) + { + var typeInfo = type.GetTypeInfo(); + return typeInfo.IsPrimitive + || typeInfo.IsEnum + || type == typeof(string) + || type == typeof(decimal); + } + + // https://stackoverflow.com/a/32025393/294804 + private static bool HasImplicitConversion(this Type baseType, Type targetType) => + baseType.GetMethods(BindingFlags.Public | BindingFlags.Static) + .Where(mi => mi.Name == "op_Implicit" && mi.ReturnType == targetType) + .Any(mi => mi.GetParameters().FirstOrDefault()?.ParameterType == baseType); + + public static bool IsPsSimple(this Type type) + { + var unwrappedType = type.Unwrap(); + return unwrappedType.IsSimple() + || unwrappedType == typeof(SwitchParameter) + || unwrappedType == typeof(Hashtable) + || unwrappedType == typeof(PSCredential) + || unwrappedType == typeof(ScriptBlock) + || unwrappedType == typeof(DateTime) + || unwrappedType == typeof(Uri) + || unwrappedType.HasImplicitConversion(typeof(string)); + } + + public static string ToPsList(this IEnumerable items) => String.Join(", ", items.Select(i => $"'{i}'")); + + public static IEnumerable ToAliasNames(this IEnumerable attributes) => attributes.OfType().SelectMany(aa => aa.AliasNames).Distinct(); + + public static bool IsArrayAndElementTypeIsT(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return itemType.IsArray && !tType.IsArray && tType.IsAssignableFrom(itemType.GetElementType()); + } + + public static bool IsTArrayAndElementTypeIsItem(this object item) + { + var itemType = item.GetType(); + var tType = typeof(T); + return !itemType.IsArray && tType.IsArray && (tType.GetElementType()?.IsAssignableFrom(itemType) ?? false); + } + + public static bool IsTypeOrArrayOfType(this object item) => item is T || item.IsArrayAndElementTypeIsT() || item.IsTArrayAndElementTypeIsItem(); + + public static T NormalizeArrayType(this object item) + { + if (item is T result) + { + return result; + } + + if (item.IsArrayAndElementTypeIsT()) + { + var array = (T[])Convert.ChangeType(item, typeof(T[])); + return array.FirstOrDefault(); + } + + if (item.IsTArrayAndElementTypeIsItem()) + { + var tType = typeof(T); + var array = Array.CreateInstance(tType.GetElementType(), 1); + array.SetValue(item, 0); + return (T)Convert.ChangeType(array, tType); + } + + return default(T); + } + + public static T GetNestedProperty(this PSObject psObject, params string[] names) => psObject.Properties.GetNestedProperty(names); + + public static T GetNestedProperty(this PSMemberInfoCollection properties, params string[] names) + { + var lastName = names.Last(); + var nestedProperties = names.Take(names.Length - 1).Aggregate(properties, (p, n) => p?.GetProperty(n)?.Properties); + return nestedProperties != null ? nestedProperties.GetProperty(lastName) : default(T); + } + + public static T GetProperty(this PSObject psObject, string name) => psObject.Properties.GetProperty(name); + + public static T GetProperty(this PSMemberInfoCollection properties, string name) + { + switch (properties[name]?.Value) + { + case PSObject psObject when psObject.BaseObject is PSCustomObject && psObject.ImmediateBaseObject.IsTypeOrArrayOfType(): + return psObject.ImmediateBaseObject.NormalizeArrayType(); + case PSObject psObject when psObject.BaseObject.IsTypeOrArrayOfType(): + return psObject.BaseObject.NormalizeArrayType(); + case object value when value.IsTypeOrArrayOfType(): + return value.NormalizeArrayType(); + default: + return default(T); + } + } + + public static IEnumerable RunScript(this PSCmdlet cmdlet, string script) + => PsHelpers.RunScript(cmdlet.InvokeCommand, script); + + public static void RunScript(this PSCmdlet cmdlet, string script) + => cmdlet.RunScript(script); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, string script) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, script); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, string script) + => engineIntrinsics.RunScript(script); + + public static IEnumerable RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => PsHelpers.RunScript(cmdlet.InvokeCommand, block.ToString()); + + public static void RunScript(this PSCmdlet cmdlet, ScriptBlock block) + => cmdlet.RunScript(block.ToString()); + + public static IEnumerable RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => PsHelpers.RunScript(engineIntrinsics.InvokeCommand, block.ToString()); + + public static void RunScript(this EngineIntrinsics engineIntrinsics, ScriptBlock block) + => engineIntrinsics.RunScript(block.ToString()); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs b/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs new file mode 100644 index 000000000000..0b8bec2a2a98 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/PsHelpers.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Management.Automation; +using Pwsh = System.Management.Automation.PowerShell; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class PsHelpers + { + public static IEnumerable RunScript(string script) + => Pwsh.Create().AddScript(script).Invoke(); + + public static void RunScript(string script) + => RunScript(script); + + public static IEnumerable RunScript(CommandInvocationIntrinsics cii, string script) + => cii.InvokeScript(script).Select(o => o?.BaseObject).Where(o => o != null).OfType(); + + public static void RunScript(CommandInvocationIntrinsics cii, string script) + => RunScript(cii, script); + + public static IEnumerable GetModuleCmdlets(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletsCommand = String.Join(" + ", modulePaths.Select(mp => $"(Get-Command -Module (Import-Module '{mp}' -PassThru))")); + return (cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand)) + .Where(ci => ci.CommandType != CommandTypes.Alias); + } + + public static IEnumerable GetModuleCmdlets(params string[] modulePaths) + => GetModuleCmdlets(null, modulePaths); + + public static IEnumerable GetScriptCmdlets(PSCmdlet cmdlet, string scriptFolder) + { + // https://stackoverflow.com/a/40969712/294804 + var getCmdletsCommand = $@" +$currentFunctions = Get-ChildItem function: +Get-ChildItem -Path '{scriptFolder}' -Recurse -Include '*.ps1' -File | ForEach-Object {{ . $_.FullName }} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} +"; + return cmdlet?.RunScript(getCmdletsCommand) ?? RunScript(getCmdletsCommand); + } + + public static IEnumerable GetScriptCmdlets(string scriptFolder) + => GetScriptCmdlets(null, scriptFolder); + + public static IEnumerable GetScriptHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var importModules = String.Join(Environment.NewLine, modulePaths.Select(mp => $"Import-Module '{mp}'")); + var getHelpCommand = $@" +$currentFunctions = Get-ChildItem function: +{importModules} +Get-ChildItem function: | Where-Object {{ ($currentFunctions -notcontains $_) -and $_.CmdletBinding }} | ForEach-Object {{ Get-Help -Name $_.Name -Full }} +"; + return cmdlet?.RunScript(getHelpCommand) ?? RunScript(getHelpCommand); + } + + public static IEnumerable GetScriptHelpInfo(params string[] modulePaths) + => GetScriptHelpInfo(null, modulePaths); + + public static IEnumerable GetModuleCmdletsAndHelpInfo(PSCmdlet cmdlet, params string[] modulePaths) + { + var getCmdletAndHelp = String.Join(" + ", modulePaths.Select(mp => + $@"(Get-Command -Module (Import-Module '{mp}' -PassThru) | Where-Object {{ $_.CommandType -ne 'Alias' }} | ForEach-Object {{ @{{ CommandInfo = $_; HelpInfo = ( invoke-command {{ try {{ Get-Help -Name $_.Name -Full }} catch{{ '' }} }} ) }} }})" + )); + return (cmdlet?.RunScript(getCmdletAndHelp) ?? RunScript(getCmdletAndHelp)) + .Select(h => new CmdletAndHelpInfo { CommandInfo = (h["CommandInfo"] as PSObject)?.BaseObject as CommandInfo, HelpInfo = h["HelpInfo"] as PSObject }); + } + + public static IEnumerable GetModuleCmdletsAndHelpInfo(params string[] modulePaths) + => GetModuleCmdletsAndHelpInfo(null, modulePaths); + + public static CmdletAndHelpInfo ToCmdletAndHelpInfo(this CommandInfo commandInfo, PSObject helpInfo) => new CmdletAndHelpInfo { CommandInfo = commandInfo, HelpInfo = helpInfo }; + + public const string Psd1Indent = " "; + public const string GuidStart = Psd1Indent + "GUID"; + + public static Guid ReadGuidFromPsd1(string psd1Path) + { + var guid = Guid.NewGuid(); + if (File.Exists(psd1Path)) + { + var currentGuid = File.ReadAllLines(psd1Path) + .FirstOrDefault(l => l.StartsWith(GuidStart))?.Split(new[] { " = " }, StringSplitOptions.RemoveEmptyEntries) + .LastOrDefault()?.Replace("'", String.Empty); + guid = currentGuid != null ? Guid.Parse(currentGuid) : guid; + } + + return guid; + } + } + + internal class CmdletAndHelpInfo + { + public CommandInfo CommandInfo { get; set; } + public PSObject HelpInfo { get; set; } + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs new file mode 100644 index 000000000000..eb989e746276 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/StringExtensions.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class StringExtensions + { + public static string NullIfEmpty(this string text) => String.IsNullOrEmpty(text) ? null : text; + public static string NullIfWhiteSpace(this string text) => String.IsNullOrWhiteSpace(text) ? null : text; + public static string EmptyIfNull(this string text) => text ?? String.Empty; + + public static bool? ToNullableBool(this string text) => String.IsNullOrEmpty(text) ? (bool?)null : Convert.ToBoolean(text.ToLowerInvariant()); + + public static string ToUpperFirstCharacter(this string text) => String.IsNullOrEmpty(text) ? text : $"{text[0].ToString().ToUpperInvariant()}{text.Remove(0, 1)}"; + + public static string ReplaceNewLines(this string value, string replacer = " ", string[] newLineSymbols = null) + => (newLineSymbols ?? new []{ "\r\n", "\n" }).Aggregate(value.EmptyIfNull(), (current, symbol) => current.Replace(symbol, replacer)); + public static string NormalizeNewLines(this string value) => value.ReplaceNewLines("\u00A0").Replace("\u00A0", Environment.NewLine); + } +} diff --git a/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs b/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs new file mode 100644 index 000000000000..ca0d54aa0a71 --- /dev/null +++ b/src/Blockchain/generated/runtime/BuildTime/XmlExtensions.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class XmlExtensions + { + public static string ToXmlString(this T inputObject, bool excludeDeclaration = false) + { + var serializer = new XmlSerializer(typeof(T)); + //https://stackoverflow.com/a/760290/294804 + //https://stackoverflow.com/a/3732234/294804 + var namespaces = new XmlSerializerNamespaces(new[] { XmlQualifiedName.Empty }); + var xmlSettings = new XmlWriterSettings { OmitXmlDeclaration = excludeDeclaration, Indent = true }; + using (var stringWriter = new StringWriter()) + using (var xmlWriter = XmlWriter.Create(stringWriter, xmlSettings)) + { + serializer.Serialize(xmlWriter, inputObject, namespaces); + return stringWriter.ToString(); + } + } + } +} diff --git a/src/Blockchain/generated/runtime/CmdInfoHandler.cs b/src/Blockchain/generated/runtime/CmdInfoHandler.cs new file mode 100644 index 000000000000..ee2317f1e1a8 --- /dev/null +++ b/src/Blockchain/generated/runtime/CmdInfoHandler.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Management.Automation; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using NextDelegate = Func, Task>, Task>; + using SignalDelegate = Func, Task>; + + public class CmdInfoHandler + { + private readonly string processRecordId; + private readonly string parameterSetName; + private readonly InvocationInfo invocationInfo; + + public CmdInfoHandler(string processRecordId, InvocationInfo invocationInfo, string parameterSetName) + { + this.processRecordId = processRecordId; + this.parameterSetName = parameterSetName; + this.invocationInfo = invocationInfo; + } + + public Task SendAsync(HttpRequestMessage request, CancellationToken token, Action cancel, SignalDelegate signal, NextDelegate next) + { + request.Headers.Add("x-ms-client-request-id", processRecordId); + request.Headers.Add("CommandName", invocationInfo?.InvocationName); + request.Headers.Add("FullCommandName", invocationInfo?.MyCommand?.Name); + request.Headers.Add("ParameterSetName", parameterSetName); + + // continue with pipeline. + return next(request, token, cancel, signal); + } + } +} diff --git a/src/Blockchain/generated/runtime/Conversions/ConversionException.cs b/src/Blockchain/generated/runtime/Conversions/ConversionException.cs new file mode 100644 index 000000000000..a1c972846b81 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/ConversionException.cs @@ -0,0 +1,17 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class ConversionException : Exception + { + internal ConversionException(string message) + : base(message) { } + + internal ConversionException(JsonNode node, Type targetType) + : base($"Cannot convert '{node.Type}' to a {targetType.Name}") { } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs b/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs new file mode 100644 index 000000000000..5e3e10073e47 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/IJsonConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal interface IJsonConverter + { + JsonNode ToJson(object value); + + object FromJson(JsonNode node); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs new file mode 100644 index 000000000000..23338b020e0c --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/BinaryConverter.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class BinaryConverter : JsonConverter + { + internal override JsonNode ToJson(byte[] value) => new XBinary(value); + + internal override byte[] FromJson(JsonNode node) + { + switch (node.Type) + { + case JsonType.String : return Convert.FromBase64String(node.ToString()); // Base64 Encoded + case JsonType.Binary : return ((XBinary)node).Value; + } + + throw new ConversionException(node, typeof(byte[])); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs new file mode 100644 index 000000000000..af1dd3e7f537 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/BooleanConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class BooleanConverter : JsonConverter + { + internal override JsonNode ToJson(bool value) => new JsonBoolean(value); + + internal override bool FromJson(JsonNode node) => (bool)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs new file mode 100644 index 000000000000..b069041ba390 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeConverter.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DateTimeConverter : JsonConverter + { + internal override JsonNode ToJson(DateTime value) + { + return new JsonDate(value); + } + + internal override DateTime FromJson(JsonNode node) => (DateTime)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs new file mode 100644 index 000000000000..804b6f52f58c --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DateTimeOffsetConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DateTimeOffsetConverter : JsonConverter + { + internal override JsonNode ToJson(DateTimeOffset value) => new JsonDate(value); + + internal override DateTimeOffset FromJson(JsonNode node) => (DateTimeOffset)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs new file mode 100644 index 000000000000..577cf54f565e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DecimalConverter.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DecimalConverter : JsonConverter + { + internal override JsonNode ToJson(decimal value) => new JsonNumber(value.ToString()); + + internal override decimal FromJson(JsonNode node) + { + return (decimal)node; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs new file mode 100644 index 000000000000..f37267b29f8e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/DoubleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class DoubleConverter : JsonConverter + { + internal override JsonNode ToJson(double value) => new JsonNumber(value); + + internal override double FromJson(JsonNode node) => (double)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs new file mode 100644 index 000000000000..2cca6e9c2dae --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/EnumConverter.cs @@ -0,0 +1,30 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class EnumConverter : IJsonConverter + { + private readonly Type type; + + internal EnumConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + } + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + + public object FromJson(JsonNode node) + { + if (node.Type == JsonType.Number) + { + return Enum.ToObject(type, (int)node); + } + + return Enum.Parse(type, node.ToString(), ignoreCase: true); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs new file mode 100644 index 000000000000..cee49ddce024 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/GuidConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class GuidConverter : JsonConverter + { + internal override JsonNode ToJson(Guid value) => new JsonString(value.ToString()); + + internal override Guid FromJson(JsonNode node) => (Guid)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs new file mode 100644 index 000000000000..403720502e3e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/HashSet'1Converter.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class HashSetConverter : JsonConverter> + { + internal override JsonNode ToJson(HashSet value) + { + return new XSet(value); + } + + internal override HashSet FromJson(JsonNode node) + { + var collection = node as ICollection; + + if (collection.Count == 0) return null; + + // TODO: Remove Linq depedency + return new HashSet(collection.Cast()); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs new file mode 100644 index 000000000000..c2a466bea985 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int16Converter : JsonConverter + { + internal override JsonNode ToJson(short value) => new JsonNumber(value); + + internal override short FromJson(JsonNode node) => (short)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs new file mode 100644 index 000000000000..54ff49040c0d --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int32Converter : JsonConverter + { + internal override JsonNode ToJson(int value) => new JsonNumber(value); + + internal override int FromJson(JsonNode node) => (int)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs new file mode 100644 index 000000000000..43f7e415d8df --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/Int64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class Int64Converter : JsonConverter + { + internal override JsonNode ToJson(long value) => new JsonNumber(value); + + internal override long FromJson(JsonNode node) => (long)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs new file mode 100644 index 000000000000..a6460faebb88 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/JsonArrayConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonArrayConverter : JsonConverter + { + internal override JsonNode ToJson(JsonArray value) => value; + + internal override JsonArray FromJson(JsonNode node) => (JsonArray)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs new file mode 100644 index 000000000000..6699a3820d3e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/JsonObjectConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonObjectConverter : JsonConverter + { + internal override JsonNode ToJson(JsonObject value) => value; + + internal override JsonObject FromJson(JsonNode node) => (JsonObject)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs new file mode 100644 index 000000000000..a41ebe92bcf0 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/SingleConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class SingleConverter : JsonConverter + { + internal override JsonNode ToJson(float value) => new JsonNumber(value.ToString()); + + internal override float FromJson(JsonNode node) => (float)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs new file mode 100644 index 000000000000..5cdb5ddfa738 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/StringConverter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class StringConverter : JsonConverter + { + internal override JsonNode ToJson(string value) => new JsonString(value); + + internal override string FromJson(JsonNode node) => node.ToString(); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs new file mode 100644 index 000000000000..f60212c88305 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/TimeSpanConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class TimeSpanConverter : JsonConverter + { + internal override JsonNode ToJson(TimeSpan value) => new JsonString(value.ToString()); + + internal override TimeSpan FromJson(JsonNode node) => (TimeSpan)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs new file mode 100644 index 000000000000..2acaa95bdd2d --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt16Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt16Converter : JsonConverter + { + internal override JsonNode ToJson(ushort value) => new JsonNumber(value); + + internal override ushort FromJson(JsonNode node) => (ushort)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs new file mode 100644 index 000000000000..3851b380815a --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt32Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt32Converter : JsonConverter + { + internal override JsonNode ToJson(uint value) => new JsonNumber(value); + + internal override uint FromJson(JsonNode node) => (uint)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs new file mode 100644 index 000000000000..5bb226066383 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UInt64Converter.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UInt64Converter : JsonConverter + { + internal override JsonNode ToJson(ulong value) => new JsonNumber(value.ToString()); + + internal override ulong FromJson(JsonNode node) => (ulong)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs b/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs new file mode 100644 index 000000000000..7a89b9d61377 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/Instances/UriConverter.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class UriConverter : JsonConverter + { + internal override JsonNode ToJson(Uri value) => new JsonString(value.AbsoluteUri); + + internal override Uri FromJson(JsonNode node) => (Uri)node; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs new file mode 100644 index 000000000000..8dbbd5063902 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverter.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public abstract class JsonConverter : IJsonConverter + { + internal abstract T FromJson(JsonNode node); + + internal abstract JsonNode ToJson(T value); + + #region IConverter + + object IJsonConverter.FromJson(JsonNode node) => FromJson(node); + + JsonNode IJsonConverter.ToJson(object value) => ToJson((T)value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs new file mode 100644 index 000000000000..07fa244d5019 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverterAttribute.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonConverterAttribute : Attribute + { + internal JsonConverterAttribute(Type type) + { + Converter = (IJsonConverter)Activator.CreateInstance(type); + } + + internal IJsonConverter Converter { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs b/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs new file mode 100644 index 000000000000..9a9053a3ba4e --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/JsonConverterFactory.cs @@ -0,0 +1,91 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class JsonConverterFactory + { + private static readonly Dictionary converters = new Dictionary(); + + static JsonConverterFactory() + { + AddInternal(new BooleanConverter()); + AddInternal(new DateTimeConverter()); + AddInternal(new DateTimeOffsetConverter()); + AddInternal(new BinaryConverter()); + AddInternal(new DecimalConverter()); + AddInternal(new DoubleConverter()); + AddInternal(new GuidConverter()); + AddInternal(new Int16Converter()); + AddInternal(new Int32Converter()); + AddInternal(new Int64Converter()); + AddInternal(new SingleConverter()); + AddInternal(new StringConverter()); + AddInternal(new TimeSpanConverter()); + AddInternal(new UInt16Converter()); + AddInternal(new UInt32Converter()); + AddInternal(new UInt64Converter()); + AddInternal(new UriConverter()); + + // Hash sets + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + AddInternal(new HashSetConverter()); + + // JSON + + AddInternal(new JsonObjectConverter()); + AddInternal(new JsonArrayConverter()); + } + + internal static Dictionary Instances => converters; + + internal static IJsonConverter Get(Type type) + { + var details = TypeDetails.Get(type); + + if (details.JsonConverter == null) + { + throw new ConversionException($"No converter found for '{type.Name}'."); + } + + return details.JsonConverter; + } + + internal static bool TryGet(Type type, out IJsonConverter converter) + { + var typeDetails = TypeDetails.Get(type); + + converter = typeDetails.JsonConverter; + + return converter != null; + } + + private static void AddInternal(JsonConverter converter) + => converters.Add(typeof(T), converter); + + private static void AddInternal(IJsonConverter converter) + => converters.Add(typeof(T), converter); + + internal static void Add(JsonConverter converter) + { + if (converter == null) + { + throw new ArgumentNullException(nameof(converter)); + } + + AddInternal(converter); + + var type = TypeDetails.Get(); + + type.JsonConverter = converter; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs b/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs new file mode 100644 index 000000000000..084e57cad175 --- /dev/null +++ b/src/Blockchain/generated/runtime/Conversions/StringLikeConverter.cs @@ -0,0 +1,45 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class StringLikeConverter : IJsonConverter + { + private readonly Type type; + private readonly MethodInfo parseMethod; + + internal StringLikeConverter(Type type) + { + this.type = type ?? throw new ArgumentNullException(nameof(type)); + this.parseMethod = StringLikeHelper.GetParseMethod(type); + } + + public object FromJson(JsonNode node) => + parseMethod.Invoke(null, new[] { node.ToString() }); + + public JsonNode ToJson(object value) => new JsonString(value.ToString()); + } + + internal static class StringLikeHelper + { + private static readonly Type[] parseMethodParamaterTypes = new[] { typeof(string) }; + + internal static bool IsStringLike(Type type) + { + return GetParseMethod(type) != null; + } + + internal static MethodInfo GetParseMethod(Type type) + { + MethodInfo method = type.GetMethod("Parse", parseMethodParamaterTypes); + + if (method?.IsPublic != true) return null; + + return method; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs b/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs new file mode 100644 index 000000000000..cd27fe7c82e3 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/IJsonSerializable.cs @@ -0,0 +1,249 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json; +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public interface IJsonSerializable + { + JsonNode ToJson(JsonObject container = null, SerializationMode serializationMode = SerializationMode.None); + } + internal static class JsonSerializable + { + /// + /// Serializes an enumerable and returns a JsonNode. + /// + /// an IEnumerable collection of items + /// A JsonNode that contains the collection of items serialized. + private static JsonNode ToJsonValue(System.Collections.IEnumerable enumerable) + { + if (enumerable != null) + { + // is it a byte array of some kind? + if (enumerable is System.Collections.Generic.IEnumerable byteEnumerable) + { + return new XBinary(System.Linq.Enumerable.ToArray(byteEnumerable)); + } + + var hasValues = false; + // just create an array of value nodes. + var result = new XNodeArray(); + foreach (var each in enumerable) + { + // we had at least one value. + hasValues = true; + + // try to serialize it. + var node = ToJsonValue(each); + if (null != node) + { + result.Add(node); + } + } + + // if we were able to add values, (or it was just empty), return it. + if (result.Count > 0 || !hasValues) + { + return result; + } + } + + // we couldn't serialize the values. Sorry. + return null; + } + + /// + /// Serializes a valuetype to a JsonNode. + /// + /// a ValueType (ie, a primitive, enum or struct) to be serialized + /// a JsonNode with the serialized value + private static JsonNode ToJsonValue(ValueType vValue) + { + // numeric type + if (vValue is SByte || vValue is Int16 || vValue is Int32 || vValue is Int64 || vValue is Byte || vValue is UInt16 || vValue is UInt32 || vValue is UInt64 || vValue is decimal || vValue is float || vValue is double) + { + return new JsonNumber(vValue.ToString()); + } + + // boolean type + if (vValue is bool bValue) + { + return new JsonBoolean(bValue); + } + + // dates + if (vValue is DateTime dtValue) + { + return new JsonDate(dtValue); + } + + // sorry, no idea. + return null; + } + /// + /// Attempts to serialize an object by using ToJson() or ToJsonString() if they exist. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + private static JsonNode TryToJsonValue(dynamic oValue) + { + object jsonValue = null; + dynamic v = oValue; + try + { + jsonValue = v.ToJson().ToString(); + } + catch + { + // no harm... + try + { + jsonValue = v.ToJsonString().ToString(); + } + catch + { + // no worries here either. + } + } + + // if we got something out, let's use it. + if (null != jsonValue) + { + // JsonNumber is really a literal json value. Just don't try to cast that back to an actual number, ok? + return new JsonNumber(jsonValue.ToString()); + } + + return null; + } + + /// + /// Serialize an object by using a variety of methods. + /// + /// the object to be serialized. + /// the serialized JsonNode (if successful), otherwise, null + internal static JsonNode ToJsonValue(object value) + { + // things that implement our interface are preferred. + if (value is Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IJsonSerializable jsonSerializable) + { + return jsonSerializable.ToJson(); + } + + // strings are easy. + if (value is string || value is char) + { + return new JsonString(value.ToString()); + } + + // value types are fairly straightforward (fallback to ToJson()/ToJsonString() or literal JsonString ) + if (value is System.ValueType vValue) + { + return ToJsonValue(vValue) ?? TryToJsonValue(vValue) ?? new JsonString(vValue.ToString()); + } + + // dictionaries are objects that should be able to serialize + if (value is System.Collections.Generic.IDictionary dictionary) + { + return Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.ToJson(dictionary, null); + } + + // enumerable collections are handled like arrays (again, fallback to ToJson()/ToJsonString() or literal JsonString) + if (value is System.Collections.IEnumerable enumerableValue) + { + // some kind of enumerable value + return ToJsonValue(enumerableValue) ?? TryToJsonValue(value) ?? new JsonString(value.ToString()); + } + + // at this point, we're going to fallback to a string literal here, since we really have no idea what it is. + return new JsonString(value.ToString()); + } + + internal static JsonObject ToJson(System.Collections.Generic.Dictionary dictionary, JsonObject container) => ToJson((System.Collections.Generic.IDictionary)dictionary, container); + + /// + /// Serializes a dictionary into a JsonObject container. + /// + /// The dictionary to serailize + /// the container to serialize the dictionary into + /// the container + internal static JsonObject ToJson(System.Collections.Generic.IDictionary dictionary, JsonObject container) + { + container = container ?? new JsonObject(); + if (dictionary != null && dictionary.Count > 0) + { + foreach (var key in dictionary) + { + // currently, we don't serialize null values. + if (null != key.Value) + { + container.Add(key.Key, ToJsonValue(key.Value)); + continue; + } + } + } + return container; + } + + internal static Func> DeserializeDictionary(Func> dictionaryFactory) + { + return (node) => FromJson(node, dictionaryFactory(), (object)(DeserializeDictionary(dictionaryFactory)) as Func); + } + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.Dictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) => FromJson(json, (System.Collections.Generic.IDictionary)container, objectFactory, excludes); + + + internal static System.Collections.Generic.IDictionary FromJson(JsonObject json, System.Collections.Generic.IDictionary container, System.Func objectFactory, System.Collections.Generic.HashSet excludes = null) + { + if (null == json) + { + return container; + } + + foreach (var key in json.Keys) + { + if (true == excludes?.Contains(key)) + { + continue; + } + + var value = json[key]; + try + { + switch (value.Type) + { + case JsonType.Null: + // skip null values. + continue; + + case JsonType.Array: + case JsonType.Boolean: + case JsonType.Date: + case JsonType.Binary: + case JsonType.Number: + case JsonType.String: + container.Add(key, (V)value.ToValue()); + break; + case JsonType.Object: + if (objectFactory != null) + { + var v = objectFactory(value as JsonObject); + if (null != v) + { + container.Add(key, v); + } + } + break; + } + } + catch + { + } + } + return container; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonArray.cs b/src/Blockchain/generated/runtime/Customizations/JsonArray.cs new file mode 100644 index 000000000000..c91418dd8091 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonArray.cs @@ -0,0 +1,13 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public partial class JsonArray + { + internal override object ToValue() => Count == 0 ? new object[0] : System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Select(this, each => each.ToValue())); + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs b/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs new file mode 100644 index 000000000000..67a5d6aba5c9 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonBoolean.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal partial class JsonBoolean + { + internal static JsonBoolean Create(bool? value) => value is bool b ? new JsonBoolean(b) : null; + internal bool ToBoolean() => Value; + + internal override object ToValue() => Value; + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonNode.cs b/src/Blockchain/generated/runtime/Customizations/JsonNode.cs new file mode 100644 index 000000000000..f8a634111ee2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonNode.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonNode + { + /// + /// Returns the content of this node as the underlying value. + /// Will default to the string representation if not overridden in child classes. + /// + /// an object with the underlying value of the node. + internal virtual object ToValue() { + return this.ToString(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs b/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs new file mode 100644 index 000000000000..aafbf0bb59db --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonNumber.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + + public partial class JsonNumber + { + internal static readonly DateTime EpochDate = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); + private static long ToUnixTime(DateTime dateTime) + { + return (long)dateTime.Subtract(EpochDate).TotalSeconds; + } + private static DateTime FromUnixTime(long totalSeconds) + { + return EpochDate.AddSeconds(totalSeconds); + } + internal byte ToByte() => this; + internal int ToInt() => this; + internal long ToLong() => this; + internal short ToShort() => this; + internal UInt16 ToUInt16() => this; + internal UInt32 ToUInt32() => this; + internal UInt64 ToUInt64() => this; + internal decimal ToDecimal() => this; + internal double ToDouble() => this; + internal float ToFloat() => this; + + internal static JsonNumber Create(int? value) => value is int n ? new JsonNumber(n) : null; + internal static JsonNumber Create(long? value) => value is long n ? new JsonNumber(n) : null; + internal static JsonNumber Create(float? value) => value is float n ? new JsonNumber(n) : null; + internal static JsonNumber Create(double? value) => value is double n ? new JsonNumber(n) : null; + internal static JsonNumber Create(decimal? value) => value is decimal n ? new JsonNumber(n) : null; + internal static JsonNumber Create(DateTime? value) => value is DateTime date ? new JsonNumber(ToUnixTime(date)) : null; + + public static implicit operator DateTime(JsonNumber number) => FromUnixTime(number); + internal DateTime ToDateTime() => this; + + internal JsonNumber(decimal value) + { + this.value = value.ToString(); + } + internal override object ToValue() + { + if (IsInteger) + { + if (int.TryParse(this.value, out int iValue)) + { + return iValue; + } + if (long.TryParse(this.value, out long lValue)) + { + return lValue; + } + } + else + { + if (float.TryParse(this.value, out float fValue)) + { + return fValue; + } + if (double.TryParse(this.value, out double dValue)) + { + return dValue; + } + if (decimal.TryParse(this.value, out decimal dcValue)) + { + return dcValue; + } + } + return null; + } + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonObject.cs b/src/Blockchain/generated/runtime/Customizations/JsonObject.cs new file mode 100644 index 000000000000..012e4e2de0bb --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonObject.cs @@ -0,0 +1,183 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Collections.Generic; + + public partial class JsonObject + { + internal override object ToValue() => Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.JsonSerializable.FromJson(this, new System.Collections.Generic.Dictionary(), (obj) => obj.ToValue()); + + internal void SafeAdd(string name, Func valueFn) + { + if (valueFn != null) + { + var value = valueFn(); + if (null != value) + { + items.Add(name, value); + } + } + } + + internal void SafeAdd(string name, JsonNode value) + { + if (null != value) + { + items.Add(name, value); + } + } + + internal T NullableProperty(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; + } + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + //throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal JsonObject Property(string propertyName) + { + return PropertyT(propertyName); + } + + internal T PropertyT(string propertyName) where T : JsonNode + { + if (this.TryGetValue(propertyName, out JsonNode value)) + { + if (value.IsNull) + { + return null; // we're going to assume that the consumer knows what to do if null is explicity returned? + } + + if (value is T tval) + { + return tval; + } + /* it's present, but not the correct type... */ + // throw new Exception($"Property {propertyName} in object expected type {typeof(T).Name} but value of type {value.Type.ToString()} was found."); + } + return null; + } + + internal int NumberProperty(string propertyName, ref int output) => output = this.PropertyT(propertyName)?.ToInt() ?? output; + internal float NumberProperty(string propertyName, ref float output) => output = this.PropertyT(propertyName)?.ToFloat() ?? output; + internal byte NumberProperty(string propertyName, ref byte output) => output = this.PropertyT(propertyName)?.ToByte() ?? output; + internal long NumberProperty(string propertyName, ref long output) => output = this.PropertyT(propertyName)?.ToLong() ?? output; + internal double NumberProperty(string propertyName, ref double output) => output = this.PropertyT(propertyName)?.ToDouble() ?? output; + internal decimal NumberProperty(string propertyName, ref decimal output) => output = this.PropertyT(propertyName)?.ToDecimal() ?? output; + internal short NumberProperty(string propertyName, ref short output) => output = this.PropertyT(propertyName)?.ToShort() ?? output; + internal DateTime NumberProperty(string propertyName, ref DateTime output) => output = this.PropertyT(propertyName)?.ToDateTime() ?? output; + + internal int? NumberProperty(string propertyName, ref int? output) => output = this.NullableProperty(propertyName)?.ToInt() ?? null; + internal float? NumberProperty(string propertyName, ref float? output) => output = this.NullableProperty(propertyName)?.ToFloat() ?? null; + internal byte? NumberProperty(string propertyName, ref byte? output) => output = this.NullableProperty(propertyName)?.ToByte() ?? null; + internal long? NumberProperty(string propertyName, ref long? output) => output = this.NullableProperty(propertyName)?.ToLong() ?? null; + internal double? NumberProperty(string propertyName, ref double? output) => output = this.NullableProperty(propertyName)?.ToDouble() ?? null; + internal decimal? NumberProperty(string propertyName, ref decimal? output) => output = this.NullableProperty(propertyName)?.ToDecimal() ?? null; + internal short? NumberProperty(string propertyName, ref short? output) => output = this.NullableProperty(propertyName)?.ToShort() ?? null; + + internal DateTime? NumberProperty(string propertyName, ref DateTime? output) => output = this.NullableProperty(propertyName)?.ToDateTime() ?? null; + + + internal string StringProperty(string propertyName) => this.PropertyT(propertyName)?.ToString(); + internal string StringProperty(string propertyName, ref string output) => output = this.PropertyT(propertyName)?.ToString() ?? output; + internal char StringProperty(string propertyName, ref char output) => output = this.PropertyT(propertyName)?.ToChar() ?? output; + internal char? StringProperty(string propertyName, ref char? output) => output = this.PropertyT(propertyName)?.ToChar() ?? null; + + internal DateTime StringProperty(string propertyName, ref DateTime output) => DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out output) ? output : output; + internal DateTime? StringProperty(string propertyName, ref DateTime? output) => output = DateTime.TryParse(this.PropertyT(propertyName)?.ToString(), out var o) ? o : output; + + + internal bool BooleanProperty(string propertyName, ref bool output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? output; + internal bool? BooleanProperty(string propertyName, ref bool? output) => output = this.PropertyT(propertyName)?.ToBoolean() ?? null; + + internal T[] ArrayProperty(string propertyName, ref T[] output, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + } + return output; + } + internal T[] ArrayProperty(string propertyName, Func deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + var output = new T[array.Count]; + for (var i = 0; i < output.Length; i++) + { + output[i] = deserializer(array[i]); + } + return output; + } + return new T[0]; + } + internal void IterateArrayProperty(string propertyName, Action deserializer) + { + var array = this.PropertyT(propertyName); + if (array != null) + { + for (var i = 0; i < array.Count; i++) + { + deserializer(array[i]); + } + } + } + + internal Dictionary DictionaryProperty(string propertyName, ref Dictionary output, Func deserializer) + { + var dictionary = this.PropertyT(propertyName); + if (output == null) + { + output = new Dictionary(); + } + else + { + output.Clear(); + } + if (dictionary != null) + { + foreach (var key in dictionary.Keys) + { + output[key] = deserializer(dictionary[key]); + } + } + return output; + } + + internal static JsonObject Create(IDictionary source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new JsonObject(); + + foreach (var key in source.Keys) + { + result.SafeAdd(key, selector(source[key])); + } + return result; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/JsonString.cs b/src/Blockchain/generated/runtime/Customizations/JsonString.cs new file mode 100644 index 000000000000..8788e8f6d0db --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/JsonString.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Globalization; + using System.Linq; + + public partial class JsonString + { + internal static string DateFormat = "yyyy-MM-dd"; + internal static string DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK"; + internal static string DateTimeRfc1123Format = "R"; + + internal static JsonString Create(string value) => value == null ? null : new JsonString(value); + internal static JsonString Create(char? value) => value is char c ? new JsonString(c.ToString()) : null; + + internal static JsonString CreateDate(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTime(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeFormat, CultureInfo.CurrentCulture)) : null; + internal static JsonString CreateDateTimeRfc1123(DateTime? value) => value is DateTime date ? new JsonString(date.ToString(DateTimeRfc1123Format, CultureInfo.CurrentCulture)) : null; + + internal char ToChar() => this.Value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char(JsonString value) => value?.ToString()?.FirstOrDefault() ?? default(char); + public static implicit operator char? (JsonString value) => value?.ToString()?.FirstOrDefault(); + + public static implicit operator DateTime(JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime); + public static implicit operator DateTime? (JsonString value) => DateTime.TryParse(value, out var output) ? output : default(DateTime?); + + } + + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs b/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs new file mode 100644 index 000000000000..9c41283abb78 --- /dev/null +++ b/src/Blockchain/generated/runtime/Customizations/XNodeArray.cs @@ -0,0 +1,44 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System; + using System.Linq; + + public partial class XNodeArray + { + internal static XNodeArray Create(T[] source, Func selector) + { + if (source == null || selector == null) + { + return null; + } + var result = new XNodeArray(); + foreach (var item in source.Select(selector)) + { + result.SafeAdd(item); + } + return result; + } + internal void SafeAdd(JsonNode item) + { + if (item != null) + { + items.Add(item); + } + } + internal void SafeAdd(Func itemFn) + { + if (itemFn != null) + { + var item = itemFn(); + if (item != null) + { + items.Add(item); + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Debugging.cs b/src/Blockchain/generated/runtime/Debugging.cs new file mode 100644 index 000000000000..d29770aa4f8c --- /dev/null +++ b/src/Blockchain/generated/runtime/Debugging.cs @@ -0,0 +1,28 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class AttachDebugger + { + internal static void Break() + { + while (!System.Diagnostics.Debugger.IsAttached) + { + System.Console.Error.WriteLine($"Waiting for debugger to attach to process {System.Diagnostics.Process.GetCurrentProcess().Id}"); + for (int i = 0; i < 50; i++) + { + if (System.Diagnostics.Debugger.IsAttached) + { + break; + } + System.Threading.Thread.Sleep(100); + System.Console.Error.Write("."); + } + System.Console.Error.WriteLine(); + } + System.Diagnostics.Debugger.Break(); + } + } +} diff --git a/src/Blockchain/generated/runtime/DictionaryExtensions.cs b/src/Blockchain/generated/runtime/DictionaryExtensions.cs new file mode 100644 index 000000000000..2c553bcbab71 --- /dev/null +++ b/src/Blockchain/generated/runtime/DictionaryExtensions.cs @@ -0,0 +1,36 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class DictionaryExtensions + { + internal static void HashTableToDictionary(System.Collections.Hashtable hashtable, System.Collections.Generic.IDictionary dictionary) + { + foreach (var each in hashtable.Keys) + { + var key = each.ToString(); + var value = hashtable[key]; + if (null != value) + { + if (value is System.Collections.Hashtable nested) + { + HashTableToDictionary(nested, new System.Collections.Generic.Dictionary()); + } + else + { + try + { + dictionary[key] = (V)value; + } + catch + { + // Values getting dropped; not compatible with target dictionary. Not sure what to do here. + } + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventData.cs b/src/Blockchain/generated/runtime/EventData.cs new file mode 100644 index 000000000000..a8912d03fc83 --- /dev/null +++ b/src/Blockchain/generated/runtime/EventData.cs @@ -0,0 +1,78 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + + using System; + using System.Threading; + + ///Represents the data in signaled event. + public partial class EventData + { + /// + /// The type of the event being signaled + /// + public string Id; + + /// + /// The user-ready message from the event. + /// + public string Message; + + /// + /// When the event is about a parameter, this is the parameter name. + /// Used in Validation Events + /// + public string Parameter; + + /// + /// This represents a numeric value associated with the event. + /// Use for progress-style events + /// + public double Value; + + /// + /// Any extended data for an event should be serialized and stored here. + /// + public string ExtendedData; + + /// + /// If the event triggers after the request message has been created, this will contain the Request Message (which in HTTP calls would be HttpRequestMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.RequestMessgae is HttpRequestMessage httpRequest) + /// { + /// httpRequest.Headers.Add("x-request-flavor", "vanilla"); + /// } + /// + /// + public object RequestMessage; + + /// + /// If the event triggers after the response is back, this will contain the Response Message (which in HTTP calls would be HttpResponseMessage) + /// + /// Typically you'd cast this to the expected type to use it: + /// + /// if(eventData.ResponseMessage is HttpResponseMessage httpResponse){ + /// var flavor = httpResponse.Headers.GetValue("x-request-flavor"); + /// } + /// + /// + public object ResponseMessage; + + /// + /// Cancellation method for this event. + /// + /// If the event consumer wishes to cancel the request that initiated this event, call Cancel() + /// + /// + /// The original initiator of the request must provide the implementation of this. + /// + public System.Action Cancel; + } + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventDataExtensions.cs b/src/Blockchain/generated/runtime/EventDataExtensions.cs new file mode 100644 index 000000000000..d62dad4a611d --- /dev/null +++ b/src/Blockchain/generated/runtime/EventDataExtensions.cs @@ -0,0 +1,94 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + + [System.ComponentModel.TypeConverter(typeof(EventDataConverter))] + /// + /// PowerShell-specific data on top of the llc# EventData + /// + /// + /// In PowerShell, we add on the EventDataConverter to support sending events between modules. + /// Obviously, this code would need to be duplcated on both modules. + /// This is preferable to sharing a common library, as versioning makes that problematic. + /// + public partial class EventData : EventArgs + { + } + + /// + /// A PowerShell PSTypeConverter to adapt an EventData object that has been passed. + /// Usually used between modules. + /// + public class EventDataConverter : System.Management.Automation.PSTypeConverter + { + public override bool CanConvertTo(object sourceValue, Type destinationType) => false; + public override object ConvertTo(object sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => null; + public override bool CanConvertFrom(dynamic sourceValue, Type destinationType) => destinationType == typeof(EventData) && CanConvertFrom(sourceValue); + public override object ConvertFrom(dynamic sourceValue, Type destinationType, IFormatProvider formatProvider, bool ignoreCase) => ConvertFrom(sourceValue); + + /// + /// Verifies that a given object has the required members to convert it to the target type (EventData) + /// + /// Uses a dynamic type so that it is able to use the simplest code without excessive checking. + /// + /// The instance to verify + /// True, if the object has all the required parameters. + public static bool CanConvertFrom(dynamic sourceValue) + { + try + { + // check if this has *required* parameters... + sourceValue?.Id?.GetType(); + sourceValue?.Message?.GetType(); + sourceValue?.Cancel?.GetType(); + + // remaining parameters are not *required*, + // and if they have values, it will copy them at conversion time. + } + catch + { + // if anything throws an exception (because it's null, or doesn't have that member) + return false; + } + return true; + } + + /// + /// Returns result of the delegate as the expected type, or default(T) + /// + /// This isolates any exceptions from the consumer. + /// + /// A delegate that returns a value + /// The desired output type + /// The value from the function if the type is correct + private static T To(Func srcValue) + { + try { return srcValue(); } + catch { return default(T); } + } + + /// + /// Converts an incoming object to the expected type by treating the incoming object as a dynamic, and coping the expected values. + /// + /// the incoming object + /// EventData + public static EventData ConvertFrom(dynamic sourceValue) + { + return new EventData + { + Id = To(() => sourceValue.Id), + Message = To(() => sourceValue.Message), + Parameter = To(() => sourceValue.Parameter), + Value = To(() => sourceValue.Value), + RequestMessage = To(() => sourceValue.RequestMessage), + ResponseMessage = To(() => sourceValue.ResponseMessage), + Cancel = To(() => sourceValue.Cancel) + }; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventListener.cs b/src/Blockchain/generated/runtime/EventListener.cs new file mode 100644 index 000000000000..c636a4061ee8 --- /dev/null +++ b/src/Blockchain/generated/runtime/EventListener.cs @@ -0,0 +1,247 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + + using System; + using System.Linq; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData = System.Func; + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public interface IValidates + { + Task Validate(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IEventListener listener); + } + + /// + /// The IEventListener Interface defines the communication mechanism for Signaling events during a remote call. + /// + /// + /// The interface is designed to be as minimal as possible, allow for quick peeking of the event type (id) + /// and the cancellation status and provides a delegate for retrieving the event details themselves. + /// + public interface IEventListener + { + Task Signal(string id, CancellationToken token, GetEventData createMessage); + CancellationToken Token { get; } + System.Action Cancel { get; } + } + + internal static partial class Extensions + { + public static Task Signal(this IEventListener instance, string id, CancellationToken token, Func createMessage) => instance.Signal(id, token, createMessage); + public static Task Signal(this IEventListener instance, string id, CancellationToken token) => instance.Signal(id, token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, HttpResponseMessage response) => instance.Signal(id, token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, CancellationToken token, EventData message) => instance.Signal(id, token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, Func createMessage) => instance.Signal(id, instance.Token, createMessage); + public static Task Signal(this IEventListener instance, string id) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = request, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, string messageText, double magnitude, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = messageText, RequestMessage = response.RequestMessage, ResponseMessage = response, Value = magnitude, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpRequestMessage request, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = request, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, HttpResponseMessage response) => instance.Signal(id, instance.Token, () => new EventData { Id = id, RequestMessage = response.RequestMessage, ResponseMessage = response, Cancel = instance.Cancel }); + public static Task Signal(this IEventListener instance, string id, EventData message) => instance.Signal(id, instance.Token, () => { message.Id = id; message.Cancel = instance.Cancel; return message; }); + + public static Task Signal(this IEventListener instance, string id, System.Uri uri) => instance.Signal(id, instance.Token, () => new EventData { Id = id, Message = uri.ToString(), Cancel = instance.Cancel }); + + public static async Task AssertNotNull(this IEventListener instance, string parameterName, object value) + { + if (value == null) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' should not be null", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMinimumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length < length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is less than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertMaximumLength(this IEventListener instance, string parameterName, string value, int length) + { + if (value != null && value.Length > length) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Length of '{parameterName}' is greater than {length}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + + public static async Task AssertRegEx(this IEventListener instance, string parameterName, string value, string regularExpression) + { + if (value != null && !System.Text.RegularExpressions.Regex.Match(value, regularExpression).Success) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' does not validate against pattern /{regularExpression}/", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertEnum(this IEventListener instance, string parameterName, string value, params string[] values) + { + if (!values.Any(each => each.Equals(value))) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"'{parameterName}' is not one of ({values.Aggregate((c, e) => $"'{e}',{c}")}", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertObjectIsValid(this IEventListener instance, string parameterName, object inst) + { + await (inst as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.IValidates)?.Validate(instance); + } + + public static async Task AssertIsLessThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) >= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThan(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) <= 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsLessThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) > 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be less than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsGreaterThanOrEqual(this IEventListener instance, string parameterName, T? value, T max) where T : struct, System.IComparable + { + if (null != value && ((T)value).CompareTo(max) < 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be greater than or equal to {max} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, Int64? value, Int64 multiple) + { + if (null != value && value % multiple != 0) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, double? value, double multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + public static async Task AssertIsMultipleOf(this IEventListener instance, string parameterName, decimal? value, decimal multiple) + { + if (null != value) + { + var i = (Int64)(value / multiple); + if (i != value / multiple) + { + await instance.Signal(Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, instance.Token, () => new EventData { Id = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Events.ValidationWarning, Message = $"Value of '{parameterName}' must be multiple of {multiple} (value is {value})", Parameter = parameterName, Cancel = instance.Cancel }); + } + } + } + } + + /// + /// An Implementation of the IEventListener that supports subscribing to events and dispatching them + /// (used for manually using the lowlevel interface) + /// + public class EventListener : CancellationTokenSource, IEnumerable>, IEventListener + { + private Dictionary calls = new Dictionary(); + public IEnumerator> GetEnumerator() => calls.GetEnumerator(); + IEnumerator IEnumerable.GetEnumerator() => calls.GetEnumerator(); + public EventListener() + { + } + + public new Action Cancel => base.Cancel; + private Event tracer; + + public EventListener(params (string name, Event callback)[] initializer) + { + foreach (var each in initializer) + { + Add(each.name, each.callback); + } + } + + public void Add(string name, SynchEvent callback) + { + Add(name, (message) => { callback(message); return Task.CompletedTask; }); + } + + public void Add(string name, Event callback) + { + if (callback != null) + { + if (string.IsNullOrEmpty(name)) + { + if (calls.ContainsKey(name)) + { + tracer += callback; + } + else + { + tracer = callback; + } + } + else + { + if (calls.ContainsKey(name)) + { + calls[name ?? System.String.Empty] += callback; + } + else + { + calls[name ?? System.String.Empty] = callback; + } + } + } + } + + + public async Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + using (NoSynchronizationContext) + { + if (!string.IsNullOrEmpty(id) && (calls.TryGetValue(id, out Event listener) || tracer != null)) + { + var message = createMessage(); + message.Id = id; + + await listener?.Invoke(message); + await tracer?.Invoke(message); + + if (token.IsCancellationRequested) + { + throw new OperationCanceledException($"Canceled by event {id} ", this.Token); + } + } + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Events.cs b/src/Blockchain/generated/runtime/Events.cs new file mode 100644 index 000000000000..85151928d343 --- /dev/null +++ b/src/Blockchain/generated/runtime/Events.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public static partial class Events + { + public const string Log = nameof(Log); + public const string Validation = nameof(Validation); + public const string ValidationWarning = nameof(ValidationWarning); + public const string AfterValidation = nameof(AfterValidation); + public const string RequestCreated = nameof(RequestCreated); + public const string ResponseCreated = nameof(ResponseCreated); + public const string URLCreated = nameof(URLCreated); + public const string Finally = nameof(Finally); + public const string HeaderParametersAdded = nameof(HeaderParametersAdded); + public const string BodyContentSet = nameof(BodyContentSet); + public const string BeforeCall = nameof(BeforeCall); + public const string BeforeResponseDispatch = nameof(BeforeResponseDispatch); + public const string FollowingNextLink = nameof(FollowingNextLink); + public const string DelayBeforePolling = nameof(DelayBeforePolling); + public const string Polling = nameof(Polling); + + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/EventsExtensions.cs b/src/Blockchain/generated/runtime/EventsExtensions.cs new file mode 100644 index 000000000000..9b3353b7ca4f --- /dev/null +++ b/src/Blockchain/generated/runtime/EventsExtensions.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public static partial class Events + { + public const string CmdletProcessRecordStart = nameof(CmdletProcessRecordStart); + public const string CmdletProcessRecordAsyncStart = nameof(CmdletProcessRecordAsyncStart); + public const string CmdletException = nameof(CmdletException); + public const string CmdletGetPipeline = nameof(CmdletGetPipeline); + public const string CmdletBeforeAPICall = nameof(CmdletBeforeAPICall); + public const string CmdletBeginProcessing = nameof(CmdletBeginProcessing); + public const string CmdletEndProcessing = nameof(CmdletEndProcessing); + public const string CmdletProcessRecordEnd = nameof(CmdletProcessRecordEnd); + public const string CmdletProcessRecordAsyncEnd = nameof(CmdletProcessRecordAsyncEnd); + public const string CmdletAfterAPICall = nameof(CmdletAfterAPICall); + + public const string Verbose = nameof(Verbose); + public const string Debug = nameof(Debug); + public const string Information = nameof(Information); + public const string Error = nameof(Error); + public const string Warning = nameof(Warning); + } + +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Extensions.cs b/src/Blockchain/generated/runtime/Extensions.cs new file mode 100644 index 000000000000..26c4863f35e1 --- /dev/null +++ b/src/Blockchain/generated/runtime/Extensions.cs @@ -0,0 +1,111 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Linq; + + internal static partial class Extensions + { + + public static T ReadHeaders(this T instance, global::System.Net.Http.Headers.HttpResponseHeaders headers) where T : class + { + (instance as IHeaderSerializable)?.ReadHeaders(headers); + return instance; + } + + internal static bool If(T input, out T output) + { + if (null == input) + { + output = default(T); + return false; + } + output = input; + return true; + } + + internal static void AddIf(T value, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(value); + } + } + + internal static void AddIf(T value, string serializedName, System.Action addMethod) + { + // if value is present (and it's not just an empty JSON Object) + if (null != value && (value as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject)?.Keys.Count != 0) + { + addMethod(serializedName, value); + } + } + + /// + /// Returns the first header value as a string from an HttpReponseMessage. + /// + /// the HttpResponseMessage to fetch a header from + /// the header name + /// the first header value as a string from an HttpReponseMessage. string.empty if there is no header value matching + internal static string GetFirstHeader(this System.Net.Http.HttpResponseMessage response, string headerName) => response.Headers.FirstOrDefault(each => headerName == each.Key).Value?.FirstOrDefault() ?? string.Empty; + + /// + /// Sets the Synchronization Context to null, and returns an IDisposable that when disposed, + /// will restore the synchonization context to the original value. + /// + /// This is used a less-invasive means to ensure that code in the library that doesn't + /// need to be continued in the original context doesn't have to have ConfigureAwait(false) + /// on every single await + /// + /// If the SynchronizationContext is null when this is used, the resulting IDisposable + /// will not do anything (this prevents excessive re-setting of the SynchronizationContext) + /// + /// Usage: + /// + /// using(NoSynchronizationContext) { + /// await SomeAsyncOperation(); + /// await SomeOtherOperation(); + /// } + /// + /// + /// + /// An IDisposable that will return the SynchronizationContext to original state + internal static System.IDisposable NoSynchronizationContext => System.Threading.SynchronizationContext.Current == null ? Dummy : new NoSyncContext(); + + /// + /// An instance of the Dummy IDispoable. + /// + /// + internal static System.IDisposable Dummy = new DummyDisposable(); + + /// + /// An IDisposable that does absolutely nothing. + /// + internal class DummyDisposable : System.IDisposable + { + public void Dispose() + { + } + } + /// + /// An IDisposable that saves the SynchronizationContext,sets it to null and + /// restores it to the original upon Dispose(). + /// + /// NOTE: This is designed to be less invasive than using .ConfigureAwait(false) + /// on every single await in library code (ie, places where we know we don't need + /// to continue in the same context as we went async) + /// + internal class NoSyncContext : System.IDisposable + { + private System.Threading.SynchronizationContext original = System.Threading.SynchronizationContext.Current; + internal NoSyncContext() + { + System.Threading.SynchronizationContext.SetSynchronizationContext(null); + } + public void Dispose() => System.Threading.SynchronizationContext.SetSynchronizationContext(original); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs b/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs new file mode 100644 index 000000000000..c6bc29891e3d --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Extensions/StringBuilderExtensions.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class StringBuilderExtensions + { + /// + /// Extracts the buffered value and resets the buffer + /// + internal static string Extract(this StringBuilder builder) + { + var text = builder.ToString(); + + builder.Clear(); + + return text; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs b/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs new file mode 100644 index 000000000000..e4569b52ac39 --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Extensions/TypeExtensions.cs @@ -0,0 +1,61 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class TypeExtensions + { + internal static bool IsNullable(this Type type) => + type.IsGenericType && type.GetGenericTypeDefinition().Equals(typeof(Nullable<>)); + + internal static Type GetOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition() == openGenericInterfaceType) + { + return candidateType; + } + + // Check if it references it's own converter.... + + foreach (Type interfaceType in candidateType.GetInterfaces()) + { + if (interfaceType.IsGenericType + && interfaceType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return interfaceType; + } + } + + return null; + } + + // Author: Sebastian Good + // http://stackoverflow.com/questions/503263/how-to-determine-if-a-type-implements-a-specific-generic-interface-type + internal static bool ImplementsOpenGenericInterface(this Type candidateType, Type openGenericInterfaceType) + { + if (candidateType.Equals(openGenericInterfaceType)) + { + return true; + } + + if (candidateType.IsGenericType && candidateType.GetGenericTypeDefinition().Equals(openGenericInterfaceType)) + { + return true; + } + + foreach (Type i in candidateType.GetInterfaces()) + { + if (i.IsGenericType && i.ImplementsOpenGenericInterface(openGenericInterfaceType)) + { + return true; + } + } + + return false; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/Seperator.cs b/src/Blockchain/generated/runtime/Helpers/Seperator.cs new file mode 100644 index 000000000000..3799307a4fde --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/Seperator.cs @@ -0,0 +1,11 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class Seperator + { + internal static readonly char[] Dash = { '-' }; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs b/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs new file mode 100644 index 000000000000..1f86c3ab3e75 --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/TypeDetails.cs @@ -0,0 +1,116 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + + internal class TypeDetails + { + private readonly Type info; + + internal TypeDetails(Type info) + { + this.info = info ?? throw new ArgumentNullException(nameof(info)); + } + + internal Type NonNullType { get; set; } + + internal object DefaultValue { get; set; } + + internal bool IsNullable { get; set; } + + internal bool IsList { get; set; } + + internal bool IsStringLike { get; set; } + + internal bool IsEnum => info.IsEnum; + + internal bool IsArray => info.IsArray; + + internal bool IsValueType => info.IsValueType; + + internal Type ElementType { get; set; } + + internal IJsonConverter JsonConverter { get; set; } + + #region Creation + + private static readonly ConcurrentDictionary cache = new ConcurrentDictionary(); + + internal static TypeDetails Get() => Get(typeof(T)); + + internal static TypeDetails Get(Type type) => cache.GetOrAdd(type, Create); + + private static TypeDetails Create(Type type) + { + var isGenericList = !type.IsPrimitive && type.ImplementsOpenGenericInterface(typeof(IList<>)); + var isList = !type.IsPrimitive && (isGenericList || typeof(IList).IsAssignableFrom(type)); + + var isNullable = type.IsNullable(); + + Type elementType; + + if (type.IsArray) + { + elementType = type.GetElementType(); + } + else if (isGenericList) + { + var iList = type.GetOpenGenericInterface(typeof(IList<>)); + + elementType = iList.GetGenericArguments()[0]; + } + else + { + elementType = null; + } + + var nonNullType = isNullable ? type.GetGenericArguments()[0] : type; + + var isStringLike = false; + + IJsonConverter converter; + + var jsonConverterAttribute = type.GetCustomAttribute(); + + if (jsonConverterAttribute != null) + { + converter = jsonConverterAttribute.Converter; + } + else if (nonNullType.IsEnum) + { + converter = new EnumConverter(nonNullType); + } + else if (JsonConverterFactory.Instances.TryGetValue(nonNullType, out converter)) + { + } + else if (StringLikeHelper.IsStringLike(nonNullType)) + { + isStringLike = true; + + converter = new StringLikeConverter(nonNullType); + } + + return new TypeDetails(nonNullType) { + NonNullType = nonNullType, + DefaultValue = type.IsValueType ? Activator.CreateInstance(type) : null, + IsNullable = isNullable, + IsList = isList, + IsStringLike = isStringLike, + ElementType = elementType, + JsonConverter = converter + }; + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Helpers/XHelper.cs b/src/Blockchain/generated/runtime/Helpers/XHelper.cs new file mode 100644 index 000000000000..84f3d468147a --- /dev/null +++ b/src/Blockchain/generated/runtime/Helpers/XHelper.cs @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class XHelper + { + internal static JsonNode Create(JsonType type, TypeCode code, object value) + { + switch (type) + { + case JsonType.Binary : return new XBinary((byte[])value); + case JsonType.Boolean : return new JsonBoolean((bool)value); + case JsonType.Number : return new JsonNumber(value.ToString()); + case JsonType.String : return new JsonString((string)value); + } + + throw new Exception($"JsonType '{type}' does not have a fast conversion"); + } + + internal static bool TryGetElementType(TypeCode code, out JsonType type) + { + switch (code) + { + case TypeCode.Boolean : type = JsonType.Boolean; return true; + case TypeCode.Byte : type = JsonType.Number; return true; + case TypeCode.DateTime : type = JsonType.Date; return true; + case TypeCode.Decimal : type = JsonType.Number; return true; + case TypeCode.Double : type = JsonType.Number; return true; + case TypeCode.Empty : type = JsonType.Null; return true; + case TypeCode.Int16 : type = JsonType.Number; return true; + case TypeCode.Int32 : type = JsonType.Number; return true; + case TypeCode.Int64 : type = JsonType.Number; return true; + case TypeCode.SByte : type = JsonType.Number; return true; + case TypeCode.Single : type = JsonType.Number; return true; + case TypeCode.String : type = JsonType.String; return true; + case TypeCode.UInt16 : type = JsonType.Number; return true; + case TypeCode.UInt32 : type = JsonType.Number; return true; + case TypeCode.UInt64 : type = JsonType.Number; return true; + } + + type = default; + + return false; + } + + internal static JsonType GetElementType(TypeCode code) + { + switch (code) + { + case TypeCode.Boolean : return JsonType.Boolean; + case TypeCode.Byte : return JsonType.Number; + case TypeCode.DateTime : return JsonType.Date; + case TypeCode.Decimal : return JsonType.Number; + case TypeCode.Double : return JsonType.Number; + case TypeCode.Empty : return JsonType.Null; + case TypeCode.Int16 : return JsonType.Number; + case TypeCode.Int32 : return JsonType.Number; + case TypeCode.Int64 : return JsonType.Number; + case TypeCode.SByte : return JsonType.Number; + case TypeCode.Single : return JsonType.Number; + case TypeCode.String : return JsonType.String; + case TypeCode.UInt16 : return JsonType.Number; + case TypeCode.UInt32 : return JsonType.Number; + case TypeCode.UInt64 : return JsonType.Number; + default : return JsonType.Object; + } + + throw new Exception($"TypeCode '{code}' does not have a fast converter"); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/HttpPipeline.cs b/src/Blockchain/generated/runtime/HttpPipeline.cs new file mode 100644 index 000000000000..762fcc410bb4 --- /dev/null +++ b/src/Blockchain/generated/runtime/HttpPipeline.cs @@ -0,0 +1,88 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + using GetEventData = System.Func; + using NextDelegate = System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + + using SignalDelegate = System.Func, System.Threading.Tasks.Task>; + using GetParameterDelegate = System.Func, string, object>; + using SendAsyncStepDelegate = System.Func, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>; + using PipelineChangeDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>; + using ModuleLoadPipelineDelegate = System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + using NewRequestPipelineDelegate = System.Action, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>, System.Action, System.Threading.Tasks.Task>, System.Func, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>, System.Threading.Tasks.Task>>>; + +/* + public class DelegateBasedEventListener : IEventListener + { + private EventListenerDelegate _listener; + public DelegateBasedEventListener(EventListenerDelegate listener) + { + _listener = listener; + } + public CancellationToken Token => CancellationToken.None; + public System.Action Cancel => () => { }; + + + public Task Signal(string id, CancellationToken token, GetEventData createMessage) + { + return _listener(id, token, () => createMessage()); + } + } +*/ + /// + /// This is a necessary extension to the SendAsyncFactory to support the 'generic' delegate format. + /// + public partial class SendAsyncFactory + { + /// + /// This translates a generic-defined delegate for a listener into one that fits our ISendAsync pattern. + /// (Provided to support out-of-module delegation for Azure Cmdlets) + /// + /// The Pipeline Step as a delegate + public SendAsyncFactory(SendAsyncStepDelegate step) => this.implementation = (request, listener, next) => + step( + request, + listener.Token, + listener.Cancel, + (id, token, getEventData) => listener.Signal(id, token, () => { + var data = EventDataConverter.ConvertFrom( getEventData() ) as EventData; + data.Id = id; + data.Cancel = listener.Cancel; + data.RequestMessage = request; + return data; + }), + (req, token, cancel, listenerDelegate) => next.SendAsync(req, listener)); + } + + public partial class HttpPipeline : ISendAsync + { + public HttpPipeline Append(SendAsyncStepDelegate item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStepDelegate item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + } +} diff --git a/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 b/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 new file mode 100644 index 000000000000..0f2720f65393 --- /dev/null +++ b/src/Blockchain/generated/runtime/HttpPipelineMocking.ps1 @@ -0,0 +1,110 @@ +$ErrorActionPreference = "Stop" + +# get the recording path +if (-not $TestRecordingFile) { + $TestRecordingFile = Join-Path $PSScriptRoot 'recording.json' +} + +# create the Http Pipeline Recorder +$Mock = New-Object -Type Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PipelineMock $TestRecordingFile + +# set the recorder to the appropriate mode (default to 'live') +Write-Host -ForegroundColor Green "Running '$TestMode' mode..." +switch ($TestMode) { + 'record' { + Write-Host -ForegroundColor Green "Recording to $TestRecordingFile" + $Mock.SetRecord() + $null = erase -ea 0 $TestRecordingFile + } + 'playback' { + if (-not (Test-Path $TestRecordingFile)) { + Write-Host -fore:yellow "Recording file '$TestRecordingFile' is not present. Tests expecting recorded responses will fail" + } else { + Write-Host -ForegroundColor Green "Using recording $TestRecordingFile" + } + $Mock.SetPlayback() + $Mock.ForceResponseHeaders["Retry-After"] = "0"; + } + default: { + $Mock.SetLive() + } +} + +# overrides for Pester Describe/Context/It + +function Describe( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushDescription($Name) + try { + return pester\Describe -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopDescription() + } +} + +function Context( + [Parameter(Mandatory = $true, Position = 0)] + [string] $Name, + + [Alias('Tags')] + [string[]] $Tag = @(), + + [Parameter(Position = 1)] + [ValidateNotNull()] + [ScriptBlock] $Fixture = $(Throw "No test script block is provided. (Have you put the open curly brace on the next line?)") +) { + $Mock.PushContext($Name) + try { + return pester\Context -Name $Name -Tag $Tag -Fixture $fixture + } + finally { + $Mock.PopContext() + } +} + +function It { + [CmdletBinding(DefaultParameterSetName = 'Normal')] + param( + [Parameter(Mandatory = $true, Position = 0)] + [string]$Name, + + [Parameter(Position = 1)] + [ScriptBlock] $Test = { }, + + [System.Collections.IDictionary[]] $TestCases, + + [Parameter(ParameterSetName = 'Pending')] + [Switch] $Pending, + + [Parameter(ParameterSetName = 'Skip')] + [Alias('Ignore')] + [Switch] $Skip + ) + $Mock.PushScenario($Name) + + try { + if ($skip) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Skip + } + if ($pending) { + return pester\It -Name $Name -Test $Test -TestCases $TestCases -Pending + } + return pester\It -Name $Name -Test $Test -TestCases $TestCases + } + finally { + $null = $Mock.PopScenario() + } +} + +# set the HttpPipelineAppend for all the cmdlets +$PSDefaultParameterValues["*:HttpPipelinePrepend"] = $Mock diff --git a/src/Blockchain/generated/runtime/IAssociativeArray.cs b/src/Blockchain/generated/runtime/IAssociativeArray.cs new file mode 100644 index 000000000000..2cc57d303db9 --- /dev/null +++ b/src/Blockchain/generated/runtime/IAssociativeArray.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + /// A subset of IDictionary that doesn't implement IEnumerable or IDictionary to work around PowerShell's aggressive formatter + public interface IAssociativeArray + { + System.Collections.Generic.IEnumerable Keys { get; } + System.Collections.Generic.IEnumerable Values { get; } + System.Collections.Generic.IDictionary AdditionalProperties { get; } + T this[string index] { get; set; } + int Count { get; } + void Add(string key, T value); + bool ContainsKey(string key); + bool Remove(string key); + bool TryGetValue(string key, out T value); + void Clear(); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/IHeaderSerializable.cs b/src/Blockchain/generated/runtime/IHeaderSerializable.cs new file mode 100644 index 000000000000..564fb335e326 --- /dev/null +++ b/src/Blockchain/generated/runtime/IHeaderSerializable.cs @@ -0,0 +1,14 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + public interface IHeaderSerializable + { + void ReadHeaders(global::System.Net.Http.Headers.HttpResponseHeaders headers); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/ISendAsync.cs b/src/Blockchain/generated/runtime/ISendAsync.cs new file mode 100644 index 000000000000..30d2d04378c3 --- /dev/null +++ b/src/Blockchain/generated/runtime/ISendAsync.cs @@ -0,0 +1,289 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Net.Http; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using System.Collections; + using System.Linq; + + /// + /// The interface for sending an HTTP request across the wire. + /// + public interface ISendAsync + { + Task SendAsync(HttpRequestMessage request, IEventListener callback); + } + + public class SendAsyncTerminalFactory : ISendAsyncTerminalFactory, ISendAsync + { + SendAsync implementation; + + public SendAsyncTerminalFactory(SendAsync implementation) => this.implementation = implementation; + public SendAsyncTerminalFactory(ISendAsync implementation) => this.implementation = implementation.SendAsync; + public ISendAsync Create() => this; + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback); + } + + public partial class SendAsyncFactory : ISendAsyncFactory + { + public class Sender : ISendAsync + { + internal ISendAsync next; + internal SendAsyncStep implementation; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => implementation(request, callback, next); + } + SendAsyncStep implementation; + + public SendAsyncFactory(SendAsyncStep implementation) => this.implementation = implementation; + public ISendAsync Create(ISendAsync next) => new Sender { next = next, implementation = implementation }; + + } + + public class HttpClientFactory : ISendAsyncTerminalFactory, ISendAsync + { + HttpClient client; + public HttpClientFactory() : this(new HttpClient()) + { + } + public HttpClientFactory(HttpClient client) => this.client = client; + public ISendAsync Create() => this; + + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, callback.Token); + } + + public interface ISendAsyncFactory + { + ISendAsync Create(ISendAsync next); + } + + public interface ISendAsyncTerminalFactory + { + ISendAsync Create(); + } + + public partial class HttpPipeline : ISendAsync + { + private ISendAsync pipeline; + private ISendAsyncTerminalFactory terminal; + private List steps = new List(); + + public HttpPipeline() : this(new HttpClientFactory()) + { + } + + public HttpPipeline(ISendAsyncTerminalFactory terminalStep) + { + if (terminalStep == null) + { + throw new System.ArgumentNullException(nameof(terminalStep), "Terminal Step Factory in HttpPipeline may not be null"); + } + TerminalFactory = terminalStep; + } + + /// + /// Returns an HttpPipeline with the current state of this pipeline. + /// + public HttpPipeline Clone() => new HttpPipeline(terminal) { steps = this.steps.ToList(), pipeline = this.pipeline }; + + public ISendAsyncTerminalFactory TerminalFactory + { + get => terminal; + set + { + if (value == null) + { + throw new System.ArgumentNullException("TerminalFactory in HttpPipeline may not be null"); + } + terminal = value; + } + } + + public ISendAsync Pipeline + { + get + { + // if the pipeline has been created and not invalidated, return it. + if (this.pipeline != null) + { + return this.pipeline; + } + + // create the pipeline from scratch. + var next = terminal.Create(); + foreach (var factory in steps) + { + // skip factories that return null. + next = factory.Create(next) ?? next; + } + return this.pipeline = next; + } + } + + public int Count => steps.Count; + + public HttpPipeline Prepend(ISendAsyncFactory item) + { + if (item != null) + { + steps.Add(item); + pipeline = null; + } + return this; + } + + public HttpPipeline Append(SendAsyncStep item) + { + if (item != null) + { + Append(new SendAsyncFactory(item)); + } + return this; + } + + public HttpPipeline Prepend(SendAsyncStep item) + { + if (item != null) + { + Prepend(new SendAsyncFactory(item)); + } + return this; + } + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(new SendAsyncFactory(item)); + } + } + return this; + } + + public HttpPipeline Append(ISendAsyncFactory item) + { + if (item != null) + { + steps.Insert(0, item); + pipeline = null; + } + return this; + } + public HttpPipeline Prepend(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Prepend(item); + } + } + return this; + } + + public HttpPipeline Append(IEnumerable items) + { + if (items != null) + { + foreach (var item in items) + { + Append(item); + } + } + return this; + } + + // you can use this as the ISendAsync Implementation + public Task SendAsync(HttpRequestMessage request, IEventListener callback) => Pipeline.SendAsync(request, callback); + } + + internal static partial class Extensions + { + internal static HttpRequestMessage CloneAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.Clone(requestUri, method); + } + } + + internal static Task CloneWithContentAndDispose(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + using (original) + { + return original.CloneWithContent(requestUri, method); + } + } + + /// + /// Clones an HttpRequestMessage (without the content) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static HttpRequestMessage Clone(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = new HttpRequestMessage + { + Method = method ?? original.Method, + RequestUri = requestUri ?? original.RequestUri, + Version = original.Version, + }; + + foreach (KeyValuePair prop in original.Properties) + { + clone.Properties.Add(prop); + } + + foreach (KeyValuePair> header in original.Headers) + { + clone.Headers.TryAddWithoutValidation(header.Key, header.Value); + } + + return clone; + } + + /// + /// Clones an HttpRequestMessage (including the content stream and content headers) + /// + /// Original HttpRequestMessage (Will be diposed before returning) + /// A clone of the HttpRequestMessage + internal static async Task CloneWithContent(this HttpRequestMessage original, System.Uri requestUri = null, System.Net.Http.HttpMethod method = null) + { + var clone = original.Clone(requestUri, method); + var stream = new System.IO.MemoryStream(); + if (original.Content != null) + { + await original.Content.CopyToAsync(stream).ConfigureAwait(false); + stream.Position = 0; + clone.Content = new StreamContent(stream); + if (original.Content.Headers != null) + { + foreach (var h in original.Content.Headers) + { + clone.Content.Headers.Add(h.Key, h.Value); + } + } + } + return clone; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/InfoAttribute.cs b/src/Blockchain/generated/runtime/InfoAttribute.cs new file mode 100644 index 000000000000..e3865b8c277f --- /dev/null +++ b/src/Blockchain/generated/runtime/InfoAttribute.cs @@ -0,0 +1,34 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Class)] + public class InfoAttribute : Attribute + { + public bool Required { get; set; } = false; + public bool ReadOnly { get; set; } = false; + public Type[] PossibleTypes { get; set; } = new Type[0]; + public string Description { get; set; } = ""; + public string SerializedName { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class CompleterInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } + + [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)] + public class DefaultInfoAttribute : Attribute + { + public string Script { get; set; } = ""; + public string Name { get; set; } = ""; + public string Description { get; set; } = ""; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Iso/IsoDate.cs b/src/Blockchain/generated/runtime/Iso/IsoDate.cs new file mode 100644 index 000000000000..0435ee7ea539 --- /dev/null +++ b/src/Blockchain/generated/runtime/Iso/IsoDate.cs @@ -0,0 +1,214 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal struct IsoDate + { + internal int Year { get; set; } // 0-3000 + + internal int Month { get; set; } // 1-12 + + internal int Day { get; set; } // 1-31 + + internal int Hour { get; set; } // 0-24 + + internal int Minute { get; set; } // 0-60 (60 is a special case) + + internal int Second { get; set; } // 0-60 (60 is used for leap seconds) + + internal double Millisecond { get; set; } // 0-999.9... + + internal TimeSpan Offset { get; set; } + + internal DateTimeKind Kind { get; set; } + + internal TimeSpan TimeOfDay => new TimeSpan(Hour, Minute, Second); + + internal DateTime ToDateTime() + { + if (Kind == DateTimeKind.Utc || Offset == TimeSpan.Zero) + { + return new DateTime(Year, Month, Day, Hour, Minute, Second, (int)Millisecond, DateTimeKind.Utc); + } + + return ToDateTimeOffset().DateTime; + } + + internal DateTimeOffset ToDateTimeOffset() + { + return new DateTimeOffset( + Year, + Month, + Day, + Hour, + Minute, + Second, + (int)Millisecond, + Offset + ); + } + + internal DateTime ToUtcDateTime() + { + return ToDateTimeOffset().UtcDateTime; + } + + public override string ToString() + { + var sb = new StringBuilder(); + + // yyyy-MM-dd + sb.Append($"{Year}-{Month:00}-{Day:00}"); + + if (TimeOfDay > new TimeSpan(0)) + { + sb.Append($"T{Hour:00}:{Minute:00}"); + + if (TimeOfDay.Seconds > 0) + { + sb.Append($":{Second:00}"); + } + } + + if (Offset.Ticks == 0) + { + sb.Append('Z'); // UTC + } + else + { + if (Offset.Ticks >= 0) + { + sb.Append('+'); + } + + sb.Append($"{Offset.Hours:00}:{Offset.Minutes:00}"); + } + + return sb.ToString(); + } + + internal static IsoDate FromDateTimeOffset(DateTimeOffset date) + { + return new IsoDate { + Year = date.Year, + Month = date.Month, + Day = date.Day, + Hour = date.Hour, + Minute = date.Minute, + Second = date.Second, + Offset = date.Offset, + Kind = date.Offset == TimeSpan.Zero ? DateTimeKind.Utc : DateTimeKind.Unspecified + }; + } + + private static readonly char[] timeSeperators = { ':', '.' }; + + internal static IsoDate Parse(string text) + { + var tzIndex = -1; + var timeIndex = text.IndexOf('T'); + + var builder = new IsoDate { Day = 1, Month = 1 }; + + // TODO: strip the time zone offset off the end + string dateTime = text; + string timeZone = null; + + if (dateTime.IndexOf('Z') > -1) + { + tzIndex = dateTime.LastIndexOf('Z'); + + builder.Kind = DateTimeKind.Utc; + } + else if (dateTime.LastIndexOf('+') > 10) + { + tzIndex = dateTime.LastIndexOf('+'); + } + else if (dateTime.LastIndexOf('-') > 10) + { + tzIndex = dateTime.LastIndexOf('-'); + } + + if (tzIndex > -1) + { + timeZone = dateTime.Substring(tzIndex); + dateTime = dateTime.Substring(0, tzIndex); + } + + string date = (timeIndex == -1) ? dateTime : dateTime.Substring(0, timeIndex); + + var dateParts = date.Split(Seperator.Dash); // '-' + + for (int i = 0; i < dateParts.Length; i++) + { + var part = dateParts[i]; + + switch (i) + { + case 0: builder.Year = int.Parse(part); break; + case 1: builder.Month = int.Parse(part); break; + case 2: builder.Day = int.Parse(part); break; + } + } + + if (timeIndex > -1) + { + string[] timeParts = dateTime.Substring(timeIndex + 1).Split(timeSeperators); + + for (int i = 0; i < timeParts.Length; i++) + { + var part = timeParts[i]; + + switch (i) + { + case 0: builder.Hour = int.Parse(part); break; + case 1: builder.Minute = int.Parse(part); break; + case 2: builder.Second = int.Parse(part); break; + case 3: builder.Millisecond = double.Parse("0." + part) * 1000; break; + } + } + } + + if (timeZone != null && timeZone != "Z") + { + var hours = int.Parse(timeZone.Substring(1, 2)); + var minutes = int.Parse(timeZone.Substring(4, 2)); + + if (timeZone[0] == '-') + { + hours = -hours; + minutes = -minutes; + } + + builder.Offset = new TimeSpan(hours, minutes, 0); + } + + return builder; + } + } + + /* + YYYY # eg 1997 + YYYY-MM # eg 1997-07 + YYYY-MM-DD # eg 1997-07-16 + YYYY-MM-DDThh:mmTZD # eg 1997-07-16T19:20+01:00 + YYYY-MM-DDThh:mm:ssTZD # eg 1997-07-16T19:20:30+01:00 + YYYY-MM-DDThh:mm:ss.sTZD # eg 1997-07-16T19:20:30.45+01:00 + + where: + + YYYY = four-digit year + MM = two-digit month (01=January, etc.) + DD = two-digit day of month (01 through 31) + hh = two digits of hour (00 through 23) (am/pm NOT allowed) + mm = two digits of minute (00 through 59) + ss = two digits of second (00 through 59) + s = one or more digits representing a decimal fraction of a second + TZD = time zone designator (Z or +hh:mm or -hh:mm) + */ +} diff --git a/src/Blockchain/generated/runtime/JsonType.cs b/src/Blockchain/generated/runtime/JsonType.cs new file mode 100644 index 000000000000..ad4504f3906d --- /dev/null +++ b/src/Blockchain/generated/runtime/JsonType.cs @@ -0,0 +1,18 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal enum JsonType + { + Null = 0, + Object = 1, + Array = 2, + Binary = 3, + Boolean = 4, + Date = 5, + Number = 6, + String = 7 + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Method.cs b/src/Blockchain/generated/runtime/Method.cs new file mode 100644 index 000000000000..94711006defb --- /dev/null +++ b/src/Blockchain/generated/runtime/Method.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + internal static class Method + { + internal static System.Net.Http.HttpMethod Get = System.Net.Http.HttpMethod.Get; + internal static System.Net.Http.HttpMethod Put = System.Net.Http.HttpMethod.Put; + internal static System.Net.Http.HttpMethod Head = System.Net.Http.HttpMethod.Head; + internal static System.Net.Http.HttpMethod Post = System.Net.Http.HttpMethod.Post; + internal static System.Net.Http.HttpMethod Delete = System.Net.Http.HttpMethod.Delete; + internal static System.Net.Http.HttpMethod Options = System.Net.Http.HttpMethod.Options; + internal static System.Net.Http.HttpMethod Trace = System.Net.Http.HttpMethod.Trace; + internal static System.Net.Http.HttpMethod Patch = new System.Net.Http.HttpMethod("PATCH"); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonMember.cs b/src/Blockchain/generated/runtime/Models/JsonMember.cs new file mode 100644 index 000000000000..cbc03c80024d --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonMember.cs @@ -0,0 +1,83 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Reflection; +using System.Runtime.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + internal sealed class JsonMember + { + private readonly TypeDetails type; + + private readonly Func getter; + private readonly Action setter; + + internal JsonMember(PropertyInfo property, int defaultOrder) + { + getter = property.GetValue; + setter = property.SetValue; + + var dataMember = property.GetCustomAttribute(); + + Name = dataMember?.Name ?? property.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(property.PropertyType); + + CanRead = property.CanRead; + } + + internal JsonMember(FieldInfo field, int defaultOrder) + { + getter = field.GetValue; + setter = field.SetValue; + + var dataMember = field.GetCustomAttribute(); + + Name = dataMember?.Name ?? field.Name; + Order = dataMember?.Order ?? defaultOrder; + EmitDefaultValue = dataMember?.EmitDefaultValue ?? true; + + this.type = TypeDetails.Get(field.FieldType); + + CanRead = true; + } + + internal string Name { get; } + + internal int Order { get; } + + internal TypeDetails TypeDetails => type; + + internal Type Type => type.NonNullType; + + internal bool IsList => type.IsList; + + // Arrays, Sets, ... + internal Type ElementType => type.ElementType; + + internal IJsonConverter Converter => type.JsonConverter; + + internal bool EmitDefaultValue { get; } + + internal bool IsStringLike => type.IsStringLike; + + internal object DefaultValue => type.DefaultValue; + + internal bool CanRead { get; } + + #region Helpers + + internal object GetValue(object instance) => getter(instance); + + internal void SetValue(object instance, object value) => setter(instance, value); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonModel.cs b/src/Blockchain/generated/runtime/Models/JsonModel.cs new file mode 100644 index 000000000000..846d8f86b664 --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonModel.cs @@ -0,0 +1,89 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Reflection; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonModel + { + private Dictionary map; + private readonly object _sync = new object(); + + private JsonModel(Type type, List members) + { + Type = type ?? throw new ArgumentNullException(nameof(type)); + Members = members ?? throw new ArgumentNullException(nameof(members)); + } + + internal string Name => Type.Name; + + internal Type Type { get; } + + internal List Members { get; } + + internal JsonMember this[string name] + { + get + { + if (map == null) + { + lock (_sync) + { + if (map == null) + { + map = new Dictionary(); + + foreach (JsonMember m in Members) + { + map[m.Name.ToLower()] = m; + } + } + } + } + + + map.TryGetValue(name.ToLower(), out JsonMember member); + + return member; + } + } + + internal static JsonModel FromType(Type type) + { + var members = new List(); + + int i = 0; + + // BindingFlags.Instance | BindingFlags.Public + + foreach (var member in type.GetFields()) + { + if (member.IsStatic) continue; + + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + foreach (var member in type.GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + if (member.IsDefined(typeof(IgnoreDataMemberAttribute))) continue; + + members.Add(new JsonMember(member, i)); + + i++; + } + + members.Sort((a, b) => a.Order.CompareTo(b.Order)); // inline sort + + return new JsonModel(type, members); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Models/JsonModelCache.cs b/src/Blockchain/generated/runtime/Models/JsonModelCache.cs new file mode 100644 index 000000000000..14db689c98d1 --- /dev/null +++ b/src/Blockchain/generated/runtime/Models/JsonModelCache.cs @@ -0,0 +1,19 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Runtime.CompilerServices; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal static class JsonModelCache + { + private static readonly ConditionalWeakTable cache + = new ConditionalWeakTable(); + + internal static JsonModel Get(Type type) => cache.GetValue(type, Create); + + private static JsonModel Create(Type type) => JsonModel.FromType(type); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs new file mode 100644 index 000000000000..bcf1dac2b273 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/JsonArray.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public abstract partial class JsonArray : JsonNode, IEnumerable + { + internal override JsonType Type => JsonType.Array; + + internal abstract JsonType? ElementType { get; } + + public abstract int Count { get; } + + internal virtual bool IsSet => false; + + internal bool IsEmpty => Count == 0; + + #region IEnumerable + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + + #region Static Helpers + + internal static JsonArray Create(short[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(int[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(long[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(decimal[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(float[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(string[] values) + => new XImmutableArray(values); + + internal static JsonArray Create(XBinary[] values) + => new XImmutableArray(values); + + #endregion + + internal static new JsonArray Parse(string text) + => (JsonArray)JsonNode.Parse(text); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs new file mode 100644 index 000000000000..699c47bf11a5 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XImmutableArray.cs @@ -0,0 +1,62 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XImmutableArray : JsonArray, IEnumerable + { + private readonly T[] values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XImmutableArray(T[] values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Length; + + public bool IsReadOnly => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (T value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + #region Static Constructor + + internal XImmutableArray Create(T[] items) + { + return new XImmutableArray(items); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs new file mode 100644 index 000000000000..6de896830847 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XList.cs @@ -0,0 +1,64 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XList : JsonArray, IEnumerable + { + private readonly IList values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XList(IList values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + public override JsonNode this[int index] => + XHelper.Create(elementType, elementCode, values[index]); + + internal override JsonType? ElementType => elementType; + + public override int Count => values.Count; + + public bool IsReadOnly => values.IsReadOnly; + + #region IList + + public void Add(T value) + { + values.Add(value); + } + + public bool Contains(T value) => values.Contains(value); + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs new file mode 100644 index 000000000000..e1285366c4d2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XNodeArray.cs @@ -0,0 +1,68 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class XNodeArray : JsonArray, ICollection + { + private readonly List items; + + internal XNodeArray() + { + items = new List(); + } + + internal XNodeArray(params JsonNode[] values) + { + items = new List(values); + } + + public override JsonNode this[int index] => items[index]; + + internal override JsonType? ElementType => null; + + public bool IsReadOnly => false; + + public override int Count => items.Count; + + #region ICollection Members + + public void Add(JsonNode item) + { + items.Add(item); + } + + void ICollection.Clear() + { + items.Clear(); + } + + public bool Contains(JsonNode item) => items.Contains(item); + + void ICollection.CopyTo(JsonNode[] array, int arrayIndex) + { + items.CopyTo(array, arrayIndex); + } + + public bool Remove(JsonNode item) + { + return items.Remove(item); + } + + #endregion + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs b/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs new file mode 100644 index 000000000000..9e02735db5c2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/Collections/XSet.cs @@ -0,0 +1,60 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XSet : JsonArray, IEnumerable + { + private readonly HashSet values; + private readonly JsonType elementType; + private readonly TypeCode elementCode; + + internal XSet(IEnumerable values) + : this(new HashSet(values)) + { } + + internal XSet(HashSet values) + { + this.values = values ?? throw new ArgumentNullException(nameof(values)); + this.elementCode = System.Type.GetTypeCode(typeof(T)); + this.elementType = XHelper.GetElementType(this.elementCode); + } + + internal override JsonType Type => JsonType.Array; + + internal override JsonType? ElementType => elementType; + + public bool IsReadOnly => true; + + public override int Count => values.Count; + + internal override bool IsSet => true; + + #region IEnumerable Members + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + foreach (var value in values) + { + yield return XHelper.Create(elementType, elementCode, value); + } + } + + #endregion + + internal HashSet AsHashSet() => values; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs b/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs new file mode 100644 index 000000000000..8e94af702738 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonBoolean.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed partial class JsonBoolean : JsonNode + { + internal static readonly JsonBoolean True = new JsonBoolean(true); + internal static readonly JsonBoolean False = new JsonBoolean(false); + + internal JsonBoolean(bool value) + { + Value = value; + } + + internal bool Value { get; } + + internal override JsonType Type => JsonType.Boolean; + + internal static new JsonBoolean Parse(string text) + { + switch (text) + { + case "false": return False; + case "true": return True; + + default: throw new ArgumentException($"Expected true or false. Was {text}."); + } + } + + #region Implicit Casts + + public static implicit operator bool(JsonBoolean data) => data.Value; + + public static implicit operator JsonBoolean(bool data) => new JsonBoolean(data); + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonDate.cs b/src/Blockchain/generated/runtime/Nodes/JsonDate.cs new file mode 100644 index 000000000000..a0f2e8cbb0e5 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonDate.cs @@ -0,0 +1,173 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + internal sealed partial class JsonDate : JsonNode, IEquatable, IComparable + { + internal static bool AssumeUtcWhenKindIsUnspecified = true; + + private readonly DateTimeOffset value; + + internal JsonDate(DateTime value) + { + if (value.Kind == DateTimeKind.Unspecified && AssumeUtcWhenKindIsUnspecified) + { + value = DateTime.SpecifyKind(value, DateTimeKind.Utc); + } + + this.value = value; + } + + internal JsonDate(DateTimeOffset value) + { + this.value = value; + } + + internal override JsonType Type => JsonType.Date; + + #region Helpers + + internal DateTimeOffset ToDateTimeOffset() + { + return value; + } + + internal DateTime ToDateTime() + { + if (value.Offset == TimeSpan.Zero) + { + return value.UtcDateTime; + } + + return value.DateTime; + } + + internal DateTime ToUtcDateTime() => value.UtcDateTime; + + internal int ToUnixTimeSeconds() + { + return (int)value.ToUnixTimeSeconds(); + } + + internal long ToUnixTimeMilliseconds() + { + return (int)value.ToUnixTimeMilliseconds(); + } + + internal string ToIsoString() + { + return IsoDate.FromDateTimeOffset(value).ToString(); + } + + #endregion + + public override string ToString() + { + return ToIsoString(); + } + + internal static new JsonDate Parse(string text) + { + if (text == null) throw new ArgumentNullException(nameof(text)); + + // TODO support: unixtimeseconds.partialseconds + + if (text.Length > 4 && _IsNumber(text)) // UnixTime + { + var date = DateTimeOffset.FromUnixTimeSeconds(long.Parse(text)); + + return new JsonDate(date); + } + else if (text.Length <= 4 || text[4] == '-') // ISO: 2012- + { + return new JsonDate(IsoDate.Parse(text).ToDateTimeOffset()); + } + else + { + // NOT ISO ENCODED + // "Thu, 5 Apr 2012 16:59:01 +0200", + return new JsonDate(DateTimeOffset.Parse(text)); + } + } + + private static bool _IsNumber(string text) + { + foreach (var c in text) + { + if (!char.IsDigit(c)) return false; + } + + return true; + } + + internal static JsonDate FromUnixTime(int seconds) + { + return new JsonDate(DateTimeOffset.FromUnixTimeSeconds(seconds)); + } + + internal static JsonDate FromUnixTime(double seconds) + { + var milliseconds = (long)(seconds * 1000d); + + return new JsonDate(DateTimeOffset.FromUnixTimeMilliseconds(milliseconds)); + } + + #region Implicit Casts + + public static implicit operator DateTimeOffset(JsonDate value) + => value.ToDateTimeOffset(); + + public static implicit operator DateTime(JsonDate value) + => value.ToDateTime(); + + // From Date + public static implicit operator JsonDate(DateTimeOffset value) + { + return new JsonDate(value); + } + + public static implicit operator JsonDate(DateTime value) + { + return new JsonDate(value); + } + + // From String + public static implicit operator JsonDate(string value) + { + return Parse(value); + } + + #endregion + + #region Equality + + public override bool Equals(object obj) + { + return obj is JsonDate date && date.value == this.value; + } + + public bool Equals(JsonDate other) + { + return this.value == other.value; + } + + public override int GetHashCode() => value.GetHashCode(); + + #endregion + + #region IComparable Members + + int IComparable.CompareTo(JsonDate other) + { + return value.CompareTo(other.value); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonNode.cs b/src/Blockchain/generated/runtime/Nodes/JsonNode.cs new file mode 100644 index 000000000000..31ecd7d0c830 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonNode.cs @@ -0,0 +1,250 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.IO; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + + + public abstract partial class JsonNode + { + internal abstract JsonType Type { get; } + + public virtual JsonNode this[int index] => throw new NotImplementedException(); + + public virtual JsonNode this[string name] + { + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); + } + + #region Type Helpers + + internal bool IsArray => Type == JsonType.Array; + + internal bool IsDate => Type == JsonType.Date; + + internal bool IsObject => Type == JsonType.Object; + + internal bool IsNumber => Type == JsonType.Number; + + internal bool IsNull => Type == JsonType.Null; + + #endregion + + internal void WriteTo(TextWriter textWriter, bool pretty = true) + { + var writer = new JsonWriter(textWriter, pretty); + + writer.WriteNode(this); + } + + internal T As() + where T : new() + => new JsonSerializer().Deseralize((JsonObject)this); + + internal T[] ToArrayOf() + { + return (T[])new JsonSerializer().DeserializeArray(typeof(T[]), (JsonArray)this); + } + + #region ToString Overrides + + public override string ToString() => ToString(pretty: true); + + internal string ToString(bool pretty) + { + var sb = new StringBuilder(); + + using (var writer = new StringWriter(sb)) + { + WriteTo(writer, pretty); + + return sb.ToString(); + } + } + + #endregion + + #region Static Constructors + + internal static JsonNode Parse(string text) + { + return Parse(new SourceReader(new StringReader(text))); + } + + internal static JsonNode Parse(TextReader textReader) + => Parse(new SourceReader(textReader)); + + private static JsonNode Parse(SourceReader sourceReader) + { + using (var parser = new JsonParser(sourceReader)) + { + return parser.ReadNode(); + } + } + + internal static JsonNode FromObject(object instance) + => new JsonSerializer().Serialize(instance); + + #endregion + + #region Implict Casts + + public static implicit operator string(JsonNode node) => node.ToString(); + + #endregion + + #region Explict Casts + + public static explicit operator DateTime(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date: + return ((JsonDate)node).ToDateTime(); + + case JsonType.String: + return JsonDate.Parse(node.ToString()).ToDateTime(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num).UtcDateTime; + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)).UtcDateTime; + } + } + + throw new ConversionException(node, typeof(DateTime)); + } + + public static explicit operator DateTimeOffset(JsonNode node) + { + switch (node.Type) + { + case JsonType.Date : return ((JsonDate)node).ToDateTimeOffset(); + case JsonType.String : return JsonDate.Parse(node.ToString()).ToDateTimeOffset(); + + case JsonType.Number: + var num = (JsonNumber)node; + + if (num.IsInteger) + { + return DateTimeOffset.FromUnixTimeSeconds(num); + } + else + { + return DateTimeOffset.FromUnixTimeMilliseconds((long)((double)num * 1000)); + } + + } + + throw new ConversionException(node, typeof(DateTimeOffset)); + } + + public static explicit operator float(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return float.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(float)); + } + + public static explicit operator double(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return double.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(double)); + } + + public static explicit operator decimal(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return decimal.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(decimal)); + } + + public static explicit operator Guid(JsonNode node) + => new Guid(node.ToString()); + + public static explicit operator short(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return short.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(short)); + } + + public static explicit operator int(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number : return (JsonNumber)node; + case JsonType.String : return int.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(int)); + } + + public static explicit operator long(JsonNode node) + { + switch (node.Type) + { + case JsonType.Number: return (JsonNumber)node; + case JsonType.String: return long.Parse(node.ToString()); + } + + throw new ConversionException(node, typeof(long)); + } + + public static explicit operator bool(JsonNode node) + => ((JsonBoolean)node).Value; + + public static explicit operator ushort(JsonNode node) + => (JsonNumber)node; + + public static explicit operator uint(JsonNode node) + => (JsonNumber)node; + + public static explicit operator ulong(JsonNode node) + => (JsonNumber)node; + + public static explicit operator TimeSpan(JsonNode node) + => TimeSpan.Parse(node.ToString()); + + public static explicit operator Uri(JsonNode node) + { + if (node.Type == JsonType.String) + { + return new Uri(node.ToString()); + } + + throw new ConversionException(node, typeof(Uri)); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs b/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs new file mode 100644 index 000000000000..5e7e87609d3c --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonNumber.cs @@ -0,0 +1,109 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class JsonNumber : JsonNode + { + private readonly string value; + private readonly bool overflows = false; + + internal JsonNumber(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal JsonNumber(int value) + { + this.value = value.ToString(); + } + + internal JsonNumber(long value) + { + this.value = value.ToString(); + + if (value > 9007199254740991) + { + overflows = true; + } + } + + internal JsonNumber(float value) + { + this.value = value.ToString(); + } + + internal JsonNumber(double value) + { + this.value = value.ToString(); + } + + internal override JsonType Type => JsonType.Number; + + internal string Value => value; + + #region Helpers + + internal bool Overflows => overflows; + + internal bool IsInteger => !value.Contains("."); + + internal bool IsFloat => value.Contains("."); + + #endregion + + #region Casting + + public static implicit operator byte(JsonNumber number) + => byte.Parse(number.Value); + + public static implicit operator short(JsonNumber number) + => short.Parse(number.Value); + + public static implicit operator int(JsonNumber number) + => int.Parse(number.Value); + + public static implicit operator long(JsonNumber number) + => long.Parse(number.value); + + public static implicit operator UInt16(JsonNumber number) + => ushort.Parse(number.Value); + + public static implicit operator UInt32(JsonNumber number) + => uint.Parse(number.Value); + + public static implicit operator UInt64(JsonNumber number) + => ulong.Parse(number.Value); + + public static implicit operator decimal(JsonNumber number) + => decimal.Parse(number.Value); + + public static implicit operator Double(JsonNumber number) + => double.Parse(number.value); + + public static implicit operator float(JsonNumber number) + => float.Parse(number.value); + + public static implicit operator JsonNumber(short data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(int data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(long data) + => new JsonNumber(data); + + public static implicit operator JsonNumber(Single data) + => new JsonNumber(data.ToString()); + + public static implicit operator JsonNumber(double data) + => new JsonNumber(data.ToString()); + + #endregion + + public override string ToString() => value; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonObject.cs b/src/Blockchain/generated/runtime/Nodes/JsonObject.cs new file mode 100644 index 000000000000..04ccd1a46db2 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonObject.cs @@ -0,0 +1,172 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public partial class JsonObject : JsonNode, IDictionary + { + private readonly Dictionary items; + + internal JsonObject() + { + items = new Dictionary(); + } + + internal JsonObject(IEnumerable> properties) + { + if (properties == null) throw new ArgumentNullException(nameof(properties)); + + items = new Dictionary(); + + foreach (var field in properties) + { + items.Add(field.Key, field.Value); + } + } + + #region IDictionary Constructors + + internal JsonObject(IDictionary dic) + { + items = new Dictionary(dic.Count); + + foreach (var pair in dic) + { + Add(pair.Key, pair.Value); + } + } + + #endregion + + internal override JsonType Type => JsonType.Object; + + #region Add Overloads + + public void Add(string name, JsonNode value) => + items.Add(name, value); + + public void Add(string name, byte[] value) => + items.Add(name, new XBinary(value)); + + public void Add(string name, DateTime value) => + items.Add(name, new JsonDate(value)); + + public void Add(string name, int value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, long value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, float value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, double value) => + items.Add(name, new JsonNumber(value.ToString())); + + public void Add(string name, string value) => + items.Add(name, new JsonString(value)); + + public void Add(string name, bool value) => + items.Add(name, new JsonBoolean(value)); + + public void Add(string name, Uri url) => + items.Add(name, new JsonString(url.AbsoluteUri)); + + public void Add(string name, string[] values) => + items.Add(name, new XImmutableArray(values)); + + public void Add(string name, int[] values) => + items.Add(name, new XImmutableArray(values)); + + #endregion + + #region ICollection> Members + + void ICollection>.Add(KeyValuePair item) + { + items.Add(item.Key, item.Value); + } + + void ICollection>.Clear() + { + items.Clear(); + } + + bool ICollection>.Contains(KeyValuePair item) => + throw new NotImplementedException(); + + void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) => + throw new NotImplementedException(); + + + int ICollection>.Count => items.Count; + + bool ICollection>.IsReadOnly => false; + + bool ICollection>.Remove(KeyValuePair item) => + throw new NotImplementedException(); + + #endregion + + #region IDictionary Members + + public bool ContainsKey(string key) => items.ContainsKey(key); + + public ICollection Keys => items.Keys; + + public bool Remove(string key) => items.Remove(key); + + public bool TryGetValue(string key, out JsonNode value) => + items.TryGetValue(key, out value); + + public ICollection Values => items.Values; + + public override JsonNode this[string key] + { + get => items[key]; + set => items[key] = value; + } + + #endregion + + #region IEnumerable + + IEnumerator> IEnumerable>.GetEnumerator() + => items.GetEnumerator(); + + IEnumerator IEnumerable.GetEnumerator() + => items.GetEnumerator(); + + #endregion + + #region Helpers + + internal static new JsonObject FromObject(object instance) => + (JsonObject)new JsonSerializer().Serialize(instance); + + #endregion + + #region Static Constructors + + internal static JsonObject FromStream(Stream stream) + { + using (var tr = new StreamReader(stream)) + { + return (JsonObject)Parse(tr); + } + } + + internal static new JsonObject Parse(string text) + { + return (JsonObject)JsonNode.Parse(text); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/JsonString.cs b/src/Blockchain/generated/runtime/Nodes/JsonString.cs new file mode 100644 index 000000000000..671aa874d383 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/JsonString.cs @@ -0,0 +1,42 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed partial class JsonString : JsonNode, IEquatable + { + private readonly string value; + + internal JsonString(string value) + { + this.value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal override JsonType Type => JsonType.String; + + internal string Value => value; + + internal int Length => value.Length; + + #region #region Implicit Casts + + public static implicit operator string(JsonString data) => data.Value; + + public static implicit operator JsonString(string value) => new JsonString(value); + + #endregion + + public override int GetHashCode() => value.GetHashCode(); + + public override string ToString() => value; + + #region IEquatable + + bool IEquatable.Equals(JsonString other) => this.Value == other.Value; + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/XBinary.cs b/src/Blockchain/generated/runtime/Nodes/XBinary.cs new file mode 100644 index 000000000000..078e2a22b2f7 --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/XBinary.cs @@ -0,0 +1,40 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XBinary : JsonNode + { + private readonly byte[] _value; + private readonly string _base64; + + internal XBinary(byte[] value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + internal XBinary(string base64EncodedString) + { + _base64 = base64EncodedString ?? throw new ArgumentNullException(nameof(base64EncodedString)); + } + + internal override JsonType Type => JsonType.Binary; + + internal byte[] Value => _value ?? Convert.FromBase64String(_base64); + + #region #region Implicit Casts + + public static implicit operator byte[] (XBinary data) => data.Value; + + public static implicit operator XBinary(byte[] data) => new XBinary(data); + + #endregion + + public override int GetHashCode() => Value.GetHashCode(); + + public override string ToString() => _base64 ?? Convert.ToBase64String(_value); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Nodes/XNull.cs b/src/Blockchain/generated/runtime/Nodes/XNull.cs new file mode 100644 index 000000000000..f7617e952edb --- /dev/null +++ b/src/Blockchain/generated/runtime/Nodes/XNull.cs @@ -0,0 +1,15 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal sealed class XNull : JsonNode + { + internal static readonly XNull Instance = new XNull(); + + private XNull() { } + + internal override JsonType Type => JsonType.Null; + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs b/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs new file mode 100644 index 000000000000..49b40c3651e4 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Exceptions/ParseException.cs @@ -0,0 +1,24 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class ParserException : Exception + { + internal ParserException(string message) + : base(message) + { } + + internal ParserException(string message, SourceLocation location) + : base(message) + { + + Location = location; + } + + internal SourceLocation Location { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonParser.cs b/src/Blockchain/generated/runtime/Parser/JsonParser.cs new file mode 100644 index 000000000000..7a4529ff8aee --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonParser.cs @@ -0,0 +1,180 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public class JsonParser : IDisposable + { + private readonly TokenReader reader; + + internal JsonParser(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonParser(SourceReader sourceReader) + { + if (sourceReader == null) + throw new ArgumentNullException(nameof(sourceReader)); + + this.reader = new TokenReader(new JsonTokenizer(sourceReader)); + + this.reader.Next(); // Start with the first token + } + + internal IEnumerable ReadNodes() + { + JsonNode node; + + while ((node = ReadNode()) != null) yield return node; + } + + internal JsonNode ReadNode() + { + if (reader.Current.Kind == TokenKind.Eof || reader.Current.IsTerminator) + { + return null; + } + + switch (reader.Current.Kind) + { + case TokenKind.LeftBrace : return ReadObject(); // { + case TokenKind.LeftBracket : return ReadArray(); // [ + + default: throw new ParserException($"Expected '{{' or '['. Was {reader.Current}."); + } + } + + private JsonNode ReadFieldValue() + { + // Boolean, Date, Null, Number, String, Uri + if (reader.Current.IsLiteral) + { + return ReadLiteral(); + } + else + { + switch (reader.Current.Kind) + { + case TokenKind.LeftBracket: return ReadArray(); + case TokenKind.LeftBrace : return ReadObject(); + + default: throw new ParserException($"Unexpected token reading field value. Was {reader.Current}."); + } + } + } + + private JsonNode ReadLiteral() + { + var literal = reader.Current; + + reader.Next(); // Read the literal token + + switch (literal.Kind) + { + case TokenKind.Boolean : return JsonBoolean.Parse(literal.Value); + case TokenKind.Null : return XNull.Instance; + case TokenKind.Number : return new JsonNumber(literal.Value); + case TokenKind.String : return new JsonString(literal.Value); + + default: throw new ParserException($"Unexpected token reading literal. Was {literal}."); + } + } + + internal JsonObject ReadObject() + { + reader.Ensure(TokenKind.LeftBrace, "object"); + + reader.Next(); // Read '{' (Object start) + + var jsonObject = new JsonObject(); + + // Read the object's fields until we reach the end of the object ('}') + while (reader.Current.Kind != TokenKind.RightBrace) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read ',' (Seperator) + } + + // Ensure we have a field name + reader.Ensure(TokenKind.String, "Expected field name"); + + var field = ReadField(); + + jsonObject.Add(field.Key, field.Value); + } + + reader.Next(); // Read '}' (Object end) + + return jsonObject; + } + + + // TODO: Use ValueTuple in C#7 + private KeyValuePair ReadField() + { + var fieldName = reader.Current.Value; + + reader.Next(); // Read the field name + + reader.Ensure(TokenKind.Colon, "field"); + + reader.Next(); // Read ':' (Field value indicator) + + return new KeyValuePair(fieldName, ReadFieldValue()); + } + + + internal JsonArray ReadArray() + { + reader.Ensure(TokenKind.LeftBracket, "array"); + + var array = new XNodeArray(); + + reader.Next(); // Read the '[' (Array start) + + // Read the array's items + while (reader.Current.Kind != TokenKind.RightBracket) + { + if (reader.Current.Kind == TokenKind.Comma) + { + reader.Next(); // Read the ',' (Seperator) + } + + if (reader.Current.IsLiteral) + { + array.Add(ReadLiteral()); // Boolean, Date, Number, Null, String, Uri + } + else if (reader.Current.Kind == TokenKind.LeftBracket) + { + array.Add(ReadArray()); // Array + } + else if (reader.Current.Kind == TokenKind.LeftBrace) + { + array.Add(ReadObject()); // Object + } + else + { + throw new ParserException($"Expected comma, literal, or object. Was {reader.Current}."); + } + } + + reader.Next(); // Read the ']' (Array end) + + return array; + } + + #region IDisposable + + public void Dispose() + { + reader.Dispose(); + } + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonToken.cs b/src/Blockchain/generated/runtime/Parser/JsonToken.cs new file mode 100644 index 000000000000..cbb139fc7cc9 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonToken.cs @@ -0,0 +1,66 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal enum TokenKind + { + LeftBrace, // { Object start + RightBrace, // } Object end + + LeftBracket, // [ Array start + RightBracket, // ] Array end + + Comma, // , Comma + Colon, // : Value indicator + Dot, // . Access field indicator + Terminator, // \0 Stream terminator + + Boolean = 31, // true or false + Null = 33, // null + Number = 34, // i.e. -1.93, -1, 0, 1, 1.1 + String = 35, // i.e. "text" + + Eof = 50 + } + + internal /* readonly */ struct JsonToken + { + internal static readonly JsonToken BraceOpen = new JsonToken(TokenKind.LeftBrace, "{"); + internal static readonly JsonToken BraceClose = new JsonToken(TokenKind.RightBrace, "}"); + + internal static readonly JsonToken BracketOpen = new JsonToken(TokenKind.LeftBracket, "["); + internal static readonly JsonToken BracketClose = new JsonToken(TokenKind.RightBracket, "]"); + + internal static readonly JsonToken Colon = new JsonToken(TokenKind.Colon, ":"); + internal static readonly JsonToken Comma = new JsonToken(TokenKind.Comma, ","); + internal static readonly JsonToken Terminator = new JsonToken(TokenKind.Terminator, "\0"); + + internal static readonly JsonToken True = new JsonToken(TokenKind.Boolean, "true"); + internal static readonly JsonToken False = new JsonToken(TokenKind.Boolean, "false"); + internal static readonly JsonToken Null = new JsonToken(TokenKind.Null, "null"); + + internal static readonly JsonToken Eof = new JsonToken(TokenKind.Eof, null); + + internal JsonToken(TokenKind kind, string value) + { + Kind = kind; + Value = value; + } + + internal readonly TokenKind Kind; + + internal readonly string Value; + + public override string ToString() => Kind + ": " + Value; + + #region Helpers + + internal bool IsLiteral => (byte)Kind > 30 && (byte)Kind < 40; + + internal bool IsTerminator => Kind == TokenKind.Terminator; + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs b/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs new file mode 100644 index 000000000000..1aa8f4c88b6e --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/JsonTokenizer.cs @@ -0,0 +1,177 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Text; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + using System.IO; + + + public class JsonTokenizer : IDisposable + { + private readonly StringBuilder sb = new StringBuilder(); + + private readonly SourceReader reader; + + internal JsonTokenizer(TextReader reader) + : this(new SourceReader(reader)) { } + + internal JsonTokenizer(SourceReader reader) + { + this.reader = reader; + + reader.Next(); // Start with the first char + } + + internal JsonToken ReadNext() + { + reader.SkipWhitespace(); + + if (reader.IsEof) return JsonToken.Eof; + + switch (reader.Current) + { + case '"': return ReadQuotedString(); + + // Symbols + case '[' : reader.Next(); return JsonToken.BracketOpen; // Array start + case ']' : reader.Next(); return JsonToken.BracketClose; // Array end + case ',' : reader.Next(); return JsonToken.Comma; // Value seperator + case ':' : reader.Next(); return JsonToken.Colon; // Field value indicator + case '{' : reader.Next(); return JsonToken.BraceOpen; // Object start + case '}' : reader.Next(); return JsonToken.BraceClose; // Object end + case '\0' : reader.Next(); return JsonToken.Terminator; // Stream terminiator + + default: return ReadLiteral(); + } + } + + private JsonToken ReadQuotedString() + { + Expect('"', "quoted string indicator"); + + reader.Next(); // Read '"' (Starting quote) + + // Read until we reach an unescaped quote char + while (reader.Current != '"') + { + EnsureNotEof("quoted string"); + + if (reader.Current == '\\') + { + char escapedCharacter = reader.ReadEscapeCode(); + + sb.Append(escapedCharacter); + + continue; + } + + StoreCurrentCharacterAndReadNext(); + } + + reader.Next(); // Read '"' (Ending quote) + + return new JsonToken(TokenKind.String, value: sb.Extract()); + } + + private JsonToken ReadLiteral() + { + if (char.IsDigit(reader.Current) || + reader.Current == '-' || + reader.Current == '+') + { + return ReadNumber(); + } + + return ReadIdentifer(); + } + + private JsonToken ReadNumber() + { + // Read until we hit a non-numeric character + // -6.247737e-06 + // E + + while (char.IsDigit(reader.Current) + || reader.Current == '.' + || reader.Current == 'e' + || reader.Current == 'E' + || reader.Current == '-' + || reader.Current == '+') + { + StoreCurrentCharacterAndReadNext(); + } + + return new JsonToken(TokenKind.Number, value: sb.Extract()); + } + + int count = 0; + + private JsonToken ReadIdentifer() + { + count++; + + if (!char.IsLetter(reader.Current)) + { + throw new ParserException( + message : $"Expected literal (number, boolean, or null). Was '{reader.Current}'.", + location : reader.Location + ); + } + + // Read letters, numbers, and underscores '_' + while (char.IsLetterOrDigit(reader.Current) || reader.Current == '_') + { + StoreCurrentCharacterAndReadNext(); + } + + string text = sb.Extract(); + + switch (text) + { + case "true": return JsonToken.True; + case "false": return JsonToken.False; + case "null": return JsonToken.Null; + + default: return new JsonToken(TokenKind.String, text); + } + } + + private void Expect(char character, string description) + { + if (reader.Current != character) + { + throw new ParserException( + message: $"Expected {description} ('{character}'). Was '{reader.Current}'.", + location: reader.Location + ); + } + } + + private void EnsureNotEof(string tokenType) + { + if (reader.IsEof) + { + throw new ParserException( + message: $"Unexpected EOF while reading {tokenType}.", + location: reader.Location + ); + } + } + + private void StoreCurrentCharacterAndReadNext() + { + sb.Append(reader.Current); + + reader.Next(); + } + + public void Dispose() + { + reader.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Location.cs b/src/Blockchain/generated/runtime/Parser/Location.cs new file mode 100644 index 000000000000..0cd69feb7107 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Location.cs @@ -0,0 +1,43 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal struct SourceLocation + { + private int line; + private int column; + private int position; + + internal SourceLocation(int line = 0, int column = 0, int position = 0) + { + this.line = line; + this.column = column; + this.position = position; + } + + internal int Line => line; + + internal int Column => column; + + internal int Position => position; + + internal void Advance() + { + this.column++; + this.position++; + } + + internal void MarkNewLine() + { + this.line++; + this.column = 0; + } + + internal SourceLocation Clone() + { + return new SourceLocation(line, column, position); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs b/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs new file mode 100644 index 000000000000..fd4d1b2c3470 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/Readers/SourceReader.cs @@ -0,0 +1,130 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Globalization; +using System.IO; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public sealed class SourceReader : IDisposable + { + private readonly TextReader source; + + private char current; + + private readonly SourceLocation location = new SourceLocation(); + + private bool isEof = false; + + internal SourceReader(TextReader textReader) + { + this.source = textReader ?? throw new ArgumentNullException(nameof(textReader)); + } + + /// + /// Advances to the next character + /// + internal void Next() + { + // Advance to the new line when we see a new line '\n'. + // A new line may be prefixed by a carriage return '\r'. + + if (current == '\n') + { + location.MarkNewLine(); + } + + int charCode = source.Read(); // -1 for end + + if (charCode >= 0) + { + current = (char)charCode; + } + else + { + // If we've already marked this as the EOF, throw an exception + if (isEof) + { + throw new EndOfStreamException("Cannot advance past end of stream."); + } + + isEof = true; + + current = '\0'; + } + + location.Advance(); + } + + internal void SkipWhitespace() + { + while (char.IsWhiteSpace(current)) + { + Next(); + } + } + + internal char ReadEscapeCode() + { + Next(); + + char escapedChar = current; + + Next(); // Consume escaped character + + switch (escapedChar) + { + // Special escape codes + case '"': return '"'; // " (Quotation mark) U+0022 + case '/': return '/'; // / (Solidus) U+002F + case '\\': return '\\'; // \ (Reverse solidus) U+005C + + // Control Characters + case '0': return '\0'; // Nul (0) U+0000 + case 'a': return '\a'; // Alert (7) + case 'b': return '\b'; // Backspace (8) U+0008 + case 'f': return '\f'; // Form feed (12) U+000C + case 'n': return '\n'; // Line feed (10) U+000A + case 'r': return '\r'; // Carriage return (13) U+000D + case 't': return '\t'; // Horizontal tab (9) U+0009 + case 'v': return '\v'; // Vertical tab + + // Unicode escape sequence + case 'u': return ReadUnicodeEscapeSequence(); // U+XXXX + + default: throw new Exception($"Unrecognized escape sequence '\\{escapedChar}'"); + } + } + + private readonly char[] hexCode = new char[4]; + + private char ReadUnicodeEscapeSequence() + { + hexCode[0] = current; Next(); + hexCode[1] = current; Next(); + hexCode[2] = current; Next(); + hexCode[3] = current; Next(); + + return Convert.ToChar(int.Parse( + s : new string(hexCode), + style : NumberStyles.HexNumber, + provider: NumberFormatInfo.InvariantInfo + )); + } + + internal char Current => current; + + internal bool IsEof => isEof; + + internal char Peek() => (char)source.Peek(); + + internal SourceLocation Location => location; + + public void Dispose() + { + source.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Parser/TokenReader.cs b/src/Blockchain/generated/runtime/Parser/TokenReader.cs new file mode 100644 index 000000000000..e7019a344485 --- /dev/null +++ b/src/Blockchain/generated/runtime/Parser/TokenReader.cs @@ -0,0 +1,39 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + public class TokenReader : IDisposable + { + private readonly JsonTokenizer tokenizer; + private JsonToken current; + + internal TokenReader(JsonTokenizer tokenizer) + { + this.tokenizer = tokenizer ?? throw new ArgumentNullException(nameof(tokenizer)); + } + + internal void Next() + { + current = tokenizer.ReadNext(); + } + + internal JsonToken Current => current; + + internal void Ensure(TokenKind kind, string readerName) + { + if (current.Kind != kind) + { + throw new ParserException($"Expected {kind} while reading {readerName}). Was {current}."); + } + } + + public void Dispose() + { + tokenizer.Dispose(); + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/PipelineMocking.cs b/src/Blockchain/generated/runtime/PipelineMocking.cs new file mode 100644 index 000000000000..0ba845d2b51b --- /dev/null +++ b/src/Blockchain/generated/runtime/PipelineMocking.cs @@ -0,0 +1,254 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System.Threading.Tasks; + using System.Collections.Generic; + using System.Net.Http; + using System.Linq; + using System.Net; + using Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json; + + public enum MockMode + { + Live, + Record, + Playback, + + } + + public class PipelineMock + { + + private System.Collections.Generic.Stack scenario = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack context = new System.Collections.Generic.Stack(); + private System.Collections.Generic.Stack description = new System.Collections.Generic.Stack(); + + private readonly string recordingPath; + private int counter = 0; + + public static implicit operator Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep(PipelineMock instance) => instance.SendAsync; + + public MockMode Mode { get; set; } = MockMode.Live; + public PipelineMock(string recordingPath) + { + this.recordingPath = recordingPath; + } + + public void PushContext(string text) => context.Push(text); + + public void PushDescription(string text) => description.Push(text); + + + public void PushScenario(string it) + { + // reset counter too + counter = 0; + + scenario.Push(it); + } + + public void PopContext() => context.Pop(); + + public void PopDescription() => description.Pop(); + + public void PopScenario() => scenario.Pop(); + + public void SetRecord() => Mode = MockMode.Record; + + public void SetPlayback() => Mode = MockMode.Playback; + + public void SetLive() => Mode = MockMode.Live; + + public string Scenario => (scenario.Count > 0 ? scenario.Peek() : "[NoScenario]"); + public string Description => (description.Count > 0 ? description.Peek() : "[NoDescription]"); + public string Context => (context.Count > 0 ? context.Peek() : "[NoContext]"); + + /// + /// Headers that we substitute out blank values for in the recordings + /// Add additional headers as necessary + /// + public static HashSet Blacklist = new HashSet(System.StringComparer.CurrentCultureIgnoreCase) { + "Authorization", + }; + + public Dictionary ForceResponseHeaders = new Dictionary(); + + internal static XImmutableArray Removed = new XImmutableArray(new string[] { "[Filtered]" }); + + internal static IEnumerable> FilterHeaders(IEnumerable>> headers) => headers.Select(header => new KeyValuePair(header.Key, Blacklist.Contains(header.Key) ? Removed : new XImmutableArray(header.Value.ToArray()))); + + internal static JsonNode SerializeContent(HttpContent content) => content == null ? XNull.Instance : SerializeContent(content.ReadAsByteArrayAsync().Result); + + internal static JsonNode SerializeContent(byte[] content) + { + if (null == content || content.Length == 0) + { + return XNull.Instance; + } + var first = content[0]; + var last = content[content.Length - 1]; + + // plaintext for JSON/SGML/XML/HTML/STRINGS/ARRAYS + if ((first == '{' && last == '}') || (first == '<' && last == '>') || (first == '[' && last == ']') || (first == '"' && last == '"')) + { + return new JsonString(System.Text.Encoding.UTF8.GetString(content)); + } + + // base64 for everyone else + return new JsonString(System.Convert.ToBase64String(content)); + } + + internal static byte[] DeserializeContent(string content) + { + if (string.IsNullOrWhiteSpace(content)) + { + return new byte[0]; + } + + if (content.EndsWith("==")) + { + try + { + return System.Convert.FromBase64String(content); + } + catch + { + // hmm. didn't work, return it as a string I guess. + } + } + return System.Text.Encoding.UTF8.GetBytes(content); + } + + public void SaveMessage(string rqKey, HttpRequestMessage request, HttpResponseMessage response) + { + var messages = System.IO.File.Exists(this.recordingPath) ? Load() : new JsonObject() ?? new JsonObject(); + messages[rqKey] = new JsonObject { + { "Request",new JsonObject { + { "Method", request.Method.Method }, + { "RequestUri", request.RequestUri }, + { "Content", SerializeContent( request.Content) }, + { "Headers", new JsonObject(FilterHeaders(request.Headers)) }, + { "ContentHeaders", request.Content == null ? new JsonObject() : new JsonObject(FilterHeaders(request.Content.Headers))} + } }, + {"Response", new JsonObject { + { "StatusCode", (int)response.StatusCode}, + { "Headers", new JsonObject(FilterHeaders(response.Headers))}, + { "ContentHeaders", new JsonObject(FilterHeaders(response.Content.Headers))}, + { "Content", SerializeContent(response.Content) }, + }} + }; + System.IO.File.WriteAllText(this.recordingPath, messages.ToString()); + } + + private JsonObject Load() + { + if (System.IO.File.Exists(this.recordingPath)) + { + try + { + return JsonObject.FromStream(System.IO.File.OpenRead(this.recordingPath)); + } + catch + { + throw new System.Exception($"Invalid recording file: '{recordingPath}'"); + } + } + + throw new System.ArgumentException($"Missing recording file: '{recordingPath}'", nameof(recordingPath)); + } + + public HttpResponseMessage LoadMessage(string rqKey) + { + var responses = Load(); + var message = responses.Property(rqKey); + + if (null == message) + { + throw new System.ArgumentException($"Missing Request '{rqKey}' in recording file", nameof(rqKey)); + } + + var sc = 0; + var reqMessage = message.Property("Request"); + var respMessage = message.Property("Response"); + + // --------------------------- deserialize response ---------------------------------------------------------------- + var response = new HttpResponseMessage + { + StatusCode = (HttpStatusCode)respMessage.NumberProperty("StatusCode", ref sc), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(respMessage.StringProperty("Content"))) + }; + + foreach (var each in respMessage.Property("Headers")) + { + response.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + foreach (var frh in ForceResponseHeaders) + { + response.Headers.Remove(frh.Key); + response.Headers.TryAddWithoutValidation(frh.Key, frh.Value); + } + + foreach (var each in respMessage.Property("ContentHeaders")) + { + response.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + // --------------------------- deserialize request ---------------------------------------------------------------- + response.RequestMessage = new HttpRequestMessage + { + Method = new HttpMethod(reqMessage.StringProperty("Method")), + RequestUri = new System.Uri(reqMessage.StringProperty("RequestUri")), + Content = new System.Net.Http.ByteArrayContent(DeserializeContent(reqMessage.StringProperty("Content"))) + }; + + foreach (var each in reqMessage.Property("Headers")) + { + response.RequestMessage.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + foreach (var each in reqMessage.Property("ContentHeaders")) + { + response.RequestMessage.Content.Headers.TryAddWithoutValidation(each.Key, each.Value.ToArrayOf()); + } + + return response; + } + + public async Task SendAsync(HttpRequestMessage request, IEventListener callback, ISendAsync next) + { + counter++; + var rqkey = $"{Description}+{Context}+{Scenario}+${request.Method.Method}+{request.RequestUri}+{counter}"; + + switch (Mode) + { + case MockMode.Record: + //Add following code since the request.Content will be released after sendAsync + var requestClone = request; + if (requestClone.Content != null) + { + requestClone = await request.CloneWithContent(request.RequestUri, request.Method); + } + // make the call + var response = await next.SendAsync(request, callback); + + // save the message to the recording file + SaveMessage(rqkey, requestClone, response); + + // return the response. + return response; + + case MockMode.Playback: + // load and return the response. + return LoadMessage(rqkey); + + default: + // pass-thru, do nothing + return await next.SendAsync(request, callback); + } + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Response.cs b/src/Blockchain/generated/runtime/Response.cs new file mode 100644 index 000000000000..37df09e5a3a7 --- /dev/null +++ b/src/Blockchain/generated/runtime/Response.cs @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Threading.Tasks; + public class Response : EventData + { + public Response() : base() + { + } + } + + public class Response : Response + { + private Func> _resultDelegate; + private Task _resultValue; + + public Response(T value) : base() => _resultValue = Task.FromResult(value); + public Response(Func value) : base() => _resultDelegate = () => Task.FromResult(value()); + public Response(Func> value) : base() => _resultDelegate = value; + public Task Result => _resultValue ?? (_resultValue = this._resultDelegate()); + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs b/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs new file mode 100644 index 000000000000..48c85c8aeee3 --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/JsonSerializer.cs @@ -0,0 +1,350 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonSerializer + { + private int depth = 0; + + private SerializationOptions options = new SerializationOptions(); + + #region Deserialization + + internal T Deseralize(JsonObject json) + where T : new() + { + var contract = JsonModelCache.Get(typeof(T)); + + return (T)DeserializeObject(contract, json); + } + + internal object DeserializeObject(JsonModel contract, JsonObject json) + { + var instance = Activator.CreateInstance(contract.Type); + + depth++; + + // Ensure we don't recurse forever + if (depth > 5) throw new Exception("Depth greater than 5"); + + foreach (var field in json) + { + var member = contract[field.Key]; + + if (member != null) + { + var value = DeserializeValue(member, field.Value); + + member.SetValue(instance, value); + } + } + + depth--; + + return instance; + } + + private object DeserializeValue(JsonMember member, JsonNode value) + { + if (value.Type == JsonType.Null) return null; + + var type = member.Type; + + if (member.IsStringLike && value.Type != JsonType.String) + { + // Take the long path... + return DeserializeObject(JsonModelCache.Get(type), (JsonObject)value); + } + else if (member.Converter != null) + { + return member.Converter.FromJson(value); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (member.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + private object DeserializeValue(Type type, JsonNode value) + { + if (type == null) throw new ArgumentNullException(nameof(type)); + + if (value.Type == JsonType.Null) return null; + + var typeDetails = TypeDetails.Get(type); + + if (typeDetails.JsonConverter != null) + { + return typeDetails.JsonConverter.FromJson(value); + } + else if (typeDetails.IsEnum) + { + return Enum.Parse(type, value.ToString(), ignoreCase: true); + } + else if (type.IsArray) + { + return DeserializeArray(type, (JsonArray)value); + } + else if (typeDetails.IsList) + { + return DeserializeList(type, (JsonArray)value); + } + else + { + var contract = JsonModelCache.Get(type); + + return DeserializeObject(contract, (JsonObject)value); + } + } + + internal Array DeserializeArray(Type type, JsonArray elements) + { + var elementType = type.GetElementType(); + + var elementTypeDetails = TypeDetails.Get(elementType); + + var array = Array.CreateInstance(elementType, elements.Count); + + int i = 0; + + if (elementTypeDetails.JsonConverter != null) + { + foreach (var value in elements) + { + array.SetValue(elementTypeDetails.JsonConverter.FromJson(value), i); + + i++; + } + } + else + { + foreach (var value in elements) + { + array.SetValue(DeserializeValue(elementType, value), i); + + i++; + } + } + + return array; + } + + internal IList DeserializeList(Type type, JsonArray jsonArray) + { + // TODO: Handle non-generic types + if (!type.IsGenericType) + throw new ArgumentException("Must be a generic type", nameof(type)); + + var elementType = type.GetGenericArguments()[0]; + + IList list; + + if (type.IsInterface) + { + // Create a concrete generic list + list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(elementType)); + } + else + { + list = (IList)Activator.CreateInstance(type); + } + + foreach (var value in jsonArray) + { + list.Add(DeserializeValue(elementType, value)); + } + + return list; + } + + #endregion + + #region Serialization + + internal JsonNode Serialize(object instance) => + Serialize(instance, SerializationOptions.Default); + + internal JsonNode Serialize(object instance, string[] include) => + Serialize(instance, new SerializationOptions { Include = include }); + + internal JsonNode Serialize(object instance, SerializationOptions options) + { + this.options = options; + + if (instance == null) + { + return XNull.Instance; + } + + return ReadValue(instance.GetType(), instance); + } + + #region Readers + + internal JsonArray ReadArray(IEnumerable collection) + { + var array = new XNodeArray(); + + foreach (var item in collection) + { + array.Add(ReadValue(item.GetType(), item)); + } + + return array; + } + + internal IEnumerable> ReadProperties(object instance) + { + var contract = JsonModelCache.Get(instance.GetType()); + + foreach (var member in contract.Members) + { + string name = member.Name; + + if (options.PropertyNameTransformer != null) + { + name = options.PropertyNameTransformer.Invoke(name); + } + + // Skip the field if it's not included + if ((depth == 1 && !options.IsIncluded(name))) + { + continue; + } + + var value = member.GetValue(instance); + + if (!member.EmitDefaultValue && (value == null || (member.IsList && ((IList)value).Count == 0) || value.Equals(member.DefaultValue))) + { + continue; + } + else if (options.IgnoreNullValues && value == null) // Ignore null values + { + continue; + } + + // Transform the value if there is one + if (options.Transformations != null) + { + var transform = options.GetTransformation(name); + + if (transform != null) + { + value = transform.Transformer(value); + } + } + + yield return new KeyValuePair(name, ReadValue(member.TypeDetails, value)); + } + } + + private JsonObject ReadObject(object instance) + { + depth++; + + // TODO: Guard against a self referencing graph + if (depth > options.MaxDepth) + { + depth--; + + return new JsonObject(); + } + + var node = new JsonObject(ReadProperties(instance)); + + depth--; + + return node; + } + + private JsonNode ReadValue(Type type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + var member = TypeDetails.Get(type); + + return ReadValue(member, value); + } + + private JsonNode ReadValue(TypeDetails type, object value) + { + if (value == null) + { + return XNull.Instance; + } + + if (type.JsonConverter != null) + { + return type.JsonConverter.ToJson(value); + } + else if (type.IsArray) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateArray((string[])value); + case TypeCode.UInt16: return CreateArray((ushort[])value); + case TypeCode.UInt32: return CreateArray((uint[])value); + case TypeCode.UInt64: return CreateArray((ulong[])value); + case TypeCode.Int16: return CreateArray((short[])value); + case TypeCode.Int32: return CreateArray((int[])value); + case TypeCode.Int64: return CreateArray((long[])value); + case TypeCode.Single: return CreateArray((float[])value); + case TypeCode.Double: return CreateArray((double[])value); + default: return ReadArray((IEnumerable)value); + } + } + else if (value is IEnumerable) + { + if (type.IsList && type.ElementType != null) + { + switch (Type.GetTypeCode(type.ElementType)) + { + case TypeCode.String: return CreateList(value); + case TypeCode.UInt16: return CreateList(value); + case TypeCode.UInt32: return CreateList(value); + case TypeCode.UInt64: return CreateList(value); + case TypeCode.Int16: return CreateList(value); + case TypeCode.Int32: return CreateList(value); + case TypeCode.Int64: return CreateList(value); + case TypeCode.Single: return CreateList(value); + case TypeCode.Double: return CreateList(value); + } + } + + return ReadArray((IEnumerable)value); + } + else + { + // Complex object + return ReadObject(value); + } + } + + private XList CreateList(object value) => new XList((IList)value); + + private XImmutableArray CreateArray(T[] array) => new XImmutableArray(array); + + #endregion + + #endregion + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs b/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs new file mode 100644 index 000000000000..07fb4dfc3486 --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/PropertyTransformation.cs @@ -0,0 +1,21 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class PropertyTransformation + { + internal PropertyTransformation(string name, Func transformer) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Transformer = transformer ?? throw new ArgumentNullException(nameof(transformer)); + } + + internal string Name { get; } + + internal Func Transformer { get; } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs b/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs new file mode 100644 index 000000000000..4eda48e9d4ef --- /dev/null +++ b/src/Blockchain/generated/runtime/Serialization/SerializationOptions.cs @@ -0,0 +1,65 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Linq; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class SerializationOptions + { + internal static readonly SerializationOptions Default = new SerializationOptions(); + + internal SerializationOptions() { } + + internal SerializationOptions( + string[] include = null, + bool ingoreNullValues = false) + { + Include = include; + IgnoreNullValues = ingoreNullValues; + } + + internal string[] Include { get; set; } + + internal string[] Exclude { get; set; } + + internal bool IgnoreNullValues { get; set; } + + internal PropertyTransformation[] Transformations { get; set; } + + internal Func PropertyNameTransformer { get; set; } + + internal int MaxDepth { get; set; } = 5; + + internal bool IsIncluded(string name) + { + if (Exclude != null) + { + return !Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + else if (Include != null) + { + return Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)); + } + + return true; + } + + internal PropertyTransformation GetTransformation(string propertyName) + { + if (Transformations == null) return null; + + foreach (var t in Transformations) + { + if (t.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase)) + { + return t; + } + } + + return null; + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/SerializationMode.cs b/src/Blockchain/generated/runtime/SerializationMode.cs new file mode 100644 index 000000000000..17084e1bcd6b --- /dev/null +++ b/src/Blockchain/generated/runtime/SerializationMode.cs @@ -0,0 +1,16 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + [System.Flags] + public enum SerializationMode + { + None = 0, + IncludeHeaders = 1 << 0, + IncludeReadOnly = 1 << 1, + + IncludeAll = IncludeHeaders | IncludeReadOnly + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/TypeConverterExtensions.cs b/src/Blockchain/generated/runtime/TypeConverterExtensions.cs new file mode 100644 index 000000000000..c7a627965d74 --- /dev/null +++ b/src/Blockchain/generated/runtime/TypeConverterExtensions.cs @@ -0,0 +1,190 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.PowerShell +{ + internal static class TypeConverterExtensions + { + internal static T[] SelectToArray(object source, System.Func converter) + { + // null begets null + if (source == null) + { + return null; + } + + // single values and strings are just encapsulated in the array. + if (source is string || !(source is System.Collections.IEnumerable)) + { + try + { + return new T[] { (T)converter(source) }; + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + return new T[0]; // empty result if couldn't convert. + } + + var result = new System.Collections.Generic.List(); + foreach (var each in (System.Collections.IEnumerable)source) + { + try + { + result.Add((T)converter(each)); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // silent conversion fail + } +#endif + } + return result.ToArray(); + } + + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.Generic.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Collections.IDictionary dictionary) + { + if (null != dictionary) + { + foreach (var each in dictionary.Keys) + { + yield return each; + } + } + } + internal static System.Collections.Generic.IEnumerable GetPropertyKeys(this System.Management.Automation.PSObject instance) + { + if (null != instance) + { + foreach (var each in instance.Properties) + { + yield return each; + } + } + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.Generic.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Collections.IDictionary instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + return (null == instance || instance.Count == 0) ? + Enumerable.Empty>() : + instance.Keys.OfType() + .Where(key => + !(true == exclusions?.Contains(key?.ToString())) + && (false != inclusions?.Contains(key?.ToString()))) + .Select(key => new System.Collections.Generic.KeyValuePair(key, instance[key])); + } + + internal static System.Collections.Generic.IEnumerable> GetFilteredProperties(this System.Management.Automation.PSObject instance, global::System.Collections.Generic.HashSet exclusions = null, global::System.Collections.Generic.HashSet inclusions = null) + { + // new global::System.Collections.Generic.HashSet(System.StringComparer.InvariantCultureIgnoreCase) + return (null == instance || !instance.Properties.Any()) ? + Enumerable.Empty>() : + instance.Properties + .Where(property => + !(true == exclusions?.Contains(property.Name)) + && (false != inclusions?.Contains(property.Name))) + .Select(property => new System.Collections.Generic.KeyValuePair(property.Name, property.Value)); + } + + + internal static T GetValueForProperty(this System.Collections.Generic.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys, each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + internal static T GetValueForProperty(this System.Collections.IDictionary dictionary, string propertyName, T defaultValue, System.Func converter) + { + try + { + var key = System.Linq.Enumerable.FirstOrDefault(dictionary.Keys.OfType(), each => System.String.Equals(each.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return key == null ? defaultValue : (T)converter(dictionary[key]); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + + internal static T GetValueForProperty(this System.Management.Automation.PSObject psObject, string propertyName, T defaultValue, System.Func converter) + { + try + { + var property = System.Linq.Enumerable.FirstOrDefault(psObject.Properties, each => System.String.Equals(each.Name.ToString(), propertyName, System.StringComparison.CurrentCultureIgnoreCase)); + return property == null ? defaultValue : (T)converter(property.Value); + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + } +#endif + return defaultValue; + } + } +} diff --git a/src/Blockchain/generated/runtime/UndeclaredResponseException.cs b/src/Blockchain/generated/runtime/UndeclaredResponseException.cs new file mode 100644 index 000000000000..c60508154566 --- /dev/null +++ b/src/Blockchain/generated/runtime/UndeclaredResponseException.cs @@ -0,0 +1,104 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + using static Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Extensions; + + public class RestException : Exception, IDisposable + { + public System.Net.HttpStatusCode StatusCode { get; set; } + public string Code { get; protected set; } + protected string message; + public HttpRequestMessage RequestMessage { get; protected set; } + public HttpResponseHeaders ResponseHeaders { get; protected set; } + + public string ResponseBody { get; protected set; } + public string ClientRequestId { get; protected set; } + public string RequestId { get; protected set; } + + public override string Message => message; + public string Action { get; protected set; } + + public RestException(System.Net.Http.HttpResponseMessage response) + { + StatusCode = response.StatusCode; + //CloneWithContent will not work here since the content is disposed after sendAsync + //Besides, it seems there is no need for the request content cloned here. + RequestMessage = response.RequestMessage.Clone(); + ResponseBody = response.Content.ReadAsStringAsync().Result; + ResponseHeaders = response.Headers; + + RequestId = response.GetFirstHeader("x-ms-request-id"); + ClientRequestId = response.GetFirstHeader("x-ms-client-request-id"); + + try + { + // try to parse the body as JSON, and see if a code and message are in there. + var json = Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonNode.Parse(ResponseBody) as Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json.JsonObject; + + // see if there is an error block in the body + json = json.Property("error") ?? json; + + { Code = If(json?.PropertyT("code"), out var c) ? (string)c : (string)StatusCode.ToString(); } + { message = If(json?.PropertyT("message"), out var m) ? (string)m : (string)Message; } + { Action = If(json?.PropertyT("action"), out var a) ? (string)a : (string)Action; } + } +#if DEBUG + catch (System.Exception E) + { + System.Console.Error.WriteLine($"{E.GetType().Name}/{E.Message}/{E.StackTrace}"); + } +#else + catch + { + // couldn't get the code/message from the body response. + // we'll create one below. + } +#endif + if (string.IsNullOrEmpty(message)) + { + if (StatusCode >= System.Net.HttpStatusCode.BadRequest && StatusCode < System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Request Error, Status: {StatusCode}"; + } + else if (StatusCode >= System.Net.HttpStatusCode.InternalServerError) + { + message = $"The server responded with a Server Error, Status: {StatusCode}"; + } + else + { + message = $"The server responded with an unrecognized response, Status: {StatusCode}"; + } + } + } + + public void Dispose() + { + ((IDisposable)RequestMessage).Dispose(); + } + } + + public class RestException : RestException + { + public T Error { get; protected set; } + public RestException(System.Net.Http.HttpResponseMessage response, T error) : base(response) + { + Error = error; + } + } + + + public class UndeclaredResponseException : RestException + { + public UndeclaredResponseException(System.Net.Http.HttpResponseMessage response) : base(response) + { + + } + } +} \ No newline at end of file diff --git a/src/Blockchain/generated/runtime/Writers/JsonWriter.cs b/src/Blockchain/generated/runtime/Writers/JsonWriter.cs new file mode 100644 index 000000000000..eba0411bb174 --- /dev/null +++ b/src/Blockchain/generated/runtime/Writers/JsonWriter.cs @@ -0,0 +1,223 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ +using System; +using System.Collections.Generic; +using System.IO; +using System.Web; + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Json +{ + internal class JsonWriter + { + const string indentation = " "; // 2 spaces + + private readonly bool pretty; + private readonly TextWriter writer; + + protected int currentLevel = 0; + + internal JsonWriter(TextWriter writer, bool pretty = true) + { + this.writer = writer ?? throw new ArgumentNullException(nameof(writer)); + this.pretty = pretty; + } + + internal void WriteNode(JsonNode node) + { + switch (node.Type) + { + case JsonType.Array: WriteArray((IEnumerable)node); break; + case JsonType.Object: WriteObject((JsonObject)node); break; + + // Primitives + case JsonType.Binary: WriteBinary((XBinary)node); break; + case JsonType.Boolean: WriteBoolean((bool)node); break; + case JsonType.Date: WriteDate((JsonDate)node); break; + case JsonType.Null: WriteNull(); break; + case JsonType.Number: WriteNumber((JsonNumber)node); break; + case JsonType.String: WriteString(node); break; + } + } + + internal void WriteArray(IEnumerable array) + { + currentLevel++; + + writer.Write('['); + + bool doIndentation = false; + + if (pretty) + { + foreach (var node in array) + { + if (node.Type == JsonType.Object || node.Type == JsonType.Array) + { + doIndentation = true; + + break; + } + } + } + + bool isFirst = true; + + foreach (JsonNode node in array) + { + if (!isFirst) writer.Write(','); + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + WriteNode(node); + + isFirst = false; + } + + currentLevel--; + + if (doIndentation) + { + WriteIndent(); + } + else if (pretty) + { + writer.Write(' '); + } + + writer.Write(']'); + } + + internal void WriteIndent() + { + if (pretty) + { + writer.Write(Environment.NewLine); + + for (int level = 0; level < currentLevel; level++) + { + writer.Write(indentation); + } + } + } + + internal void WriteObject(JsonObject obj) + { + currentLevel++; + + writer.Write('{'); + + bool isFirst = true; + + foreach (var field in obj) + { + if (!isFirst) writer.Write(','); + + WriteIndent(); + + WriteFieldName(field.Key); + + writer.Write(':'); + + if (pretty) + { + writer.Write(' '); + } + + // Write the field value + WriteNode(field.Value); + + isFirst = false; + } + + currentLevel--; + + WriteIndent(); + + writer.Write('}'); + } + + internal void WriteFieldName(string fieldName) + { + writer.Write('"'); + writer.Write(HttpUtility.JavaScriptStringEncode(fieldName)); + writer.Write('"'); + } + + #region Primitives + + internal void WriteBinary(XBinary value) + { + writer.Write('"'); + writer.Write(value.ToString()); + writer.Write('"'); + } + + internal void WriteBoolean(bool value) + { + writer.Write(value ? "true" : "false"); + } + + internal void WriteDate(JsonDate date) + { + if (date.ToDateTime().Year == 1) + { + WriteNull(); + } + else + { + writer.Write('"'); + writer.Write(date.ToIsoString()); + writer.Write('"'); + } + } + + internal void WriteNull() + { + writer.Write("null"); + } + + internal void WriteNumber(JsonNumber number) + { + if (number.Overflows) + { + writer.Write('"'); + writer.Write(number.Value); + writer.Write('"'); + } + else + { + writer.Write(number.Value); + } + } + + internal void WriteString(string text) + { + if (text == null) + { + WriteNull(); + } + else + { + writer.Write('"'); + + writer.Write(HttpUtility.JavaScriptStringEncode(text)); + + writer.Write('"'); + } + } + + #endregion + } +} + + +// TODO: Replace with System.Text.Json when available diff --git a/src/Blockchain/generated/runtime/delegates.cs b/src/Blockchain/generated/runtime/delegates.cs new file mode 100644 index 000000000000..c098da3eb8bb --- /dev/null +++ b/src/Blockchain/generated/runtime/delegates.cs @@ -0,0 +1,23 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +namespace Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + using GetEventData=System.Func; + + public delegate Task SendAsync(HttpRequestMessage request, IEventListener callback); + public delegate Task SendAsyncStep(HttpRequestMessage request, IEventListener callback, ISendAsync next); + public delegate Task SignalEvent(string id, CancellationToken token, GetEventData getEventData); + public delegate Task Event(EventData message); + public delegate void SynchEvent(EventData message); + public delegate Task OnResponse(Response message); + public delegate Task OnResponse(Response message); +} \ No newline at end of file diff --git a/src/Blockchain/help/Az.Blockchain.md b/src/Blockchain/help/Az.Blockchain.md new file mode 100644 index 000000000000..a857ee900620 --- /dev/null +++ b/src/Blockchain/help/Az.Blockchain.md @@ -0,0 +1,61 @@ +--- +Module Name: Az.Blockchain +Module Guid: ae1a09bf-916c-480c-a1bb-bace1453a91e +Download Help Link: https://docs.microsoft.com/en-us/powershell/module/az.blockchain +Help Version: 1.0.0.0 +Locale: en-US +--- + +# Az.Blockchain Module +## Description +Microsoft Azure PowerShell: Blockchain cmdlets + +## Az.Blockchain Cmdlets +### [Get-AzBlockchainConsortium](Get-AzBlockchainConsortium.md) +Lists the available consortiums for a subscription. + +### [Get-AzBlockchainMember](Get-AzBlockchainMember.md) +Get details about a blockchain member. + +### [Get-AzBlockchainMemberApiKey](Get-AzBlockchainMemberApiKey.md) +Lists the API keys for a blockchain member. + +### [Get-AzBlockchainMemberConsortiumMember](Get-AzBlockchainMemberConsortiumMember.md) +Lists the consortium members for a blockchain member. + +### [Get-AzBlockchainSku](Get-AzBlockchainSku.md) +Lists the Skus of the resource type. + +### [Get-AzBlockchainTransactionNode](Get-AzBlockchainTransactionNode.md) +Get the details of the transaction node. + +### [Get-AzBlockchainTransactionNodeApiKey](Get-AzBlockchainTransactionNodeApiKey.md) +List the API keys for the transaction node. + +### [New-AzBlockchainMember](New-AzBlockchainMember.md) +Create a blockchain member. + +### [New-AzBlockchainMemberApiKey](New-AzBlockchainMemberApiKey.md) +Regenerate the API keys for a blockchain member. + +### [New-AzBlockchainTransactionNode](New-AzBlockchainTransactionNode.md) +Create or update the transaction node. + +### [New-AzBlockchainTransactionNodeApiKey](New-AzBlockchainTransactionNodeApiKey.md) +Regenerate the API keys for the blockchain member. + +### [Remove-AzBlockchainMember](Remove-AzBlockchainMember.md) +Delete a blockchain member. + +### [Remove-AzBlockchainTransactionNode](Remove-AzBlockchainTransactionNode.md) +Delete the transaction node. + +### [Test-AzBlockchainLocationNameAvailability](Test-AzBlockchainLocationNameAvailability.md) +To check whether a resource name is available. + +### [Update-AzBlockchainMember](Update-AzBlockchainMember.md) +Update a blockchain member. + +### [Update-AzBlockchainTransactionNode](Update-AzBlockchainTransactionNode.md) +Update the transaction node. + diff --git a/src/Blockchain/help/Get-AzBlockchainConsortium.md b/src/Blockchain/help/Get-AzBlockchainConsortium.md new file mode 100644 index 000000000000..30c9982f4e7e --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainConsortium.md @@ -0,0 +1,126 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainconsortium +schema: 2.0.0 +--- + +# Get-AzBlockchainConsortium + +## SYNOPSIS +Lists the available consortiums for a subscription. + +## SYNTAX + +``` +Get-AzBlockchainConsortium -Location [-SubscriptionId ] [-DefaultProfile ] + [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Lists the available consortiums for a subscription. + +## EXAMPLES + +### Example 1: Get Blockchain consortiums. +```powershell +PS C:\> Get-AzBlockchainConsortium -Location eastus + +``` + +This command lists the consortiums under a subscription for a specific location. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortium + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMember.md b/src/Blockchain/help/Get-AzBlockchainMember.md new file mode 100644 index 000000000000..149857fb4d9d --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMember.md @@ -0,0 +1,201 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmember +schema: 2.0.0 +--- + +# Get-AzBlockchainMember + +## SYNOPSIS +Get details about a blockchain member. + +## SYNTAX + +### List1 (Default) +``` +Get-AzBlockchainMember [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzBlockchainMember -InputObject [-DefaultProfile ] [] +``` + +### List +``` +Get-AzBlockchainMember -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get details about a blockchain member. + +## EXAMPLES + +### Example 1: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember + +Location Name Type +-------- ---- ---- +eastus blockchainmember01 Microsoft.Blockchain/blockchainMembers +eastus myblockchain Microsoft.Blockchain/blockchainMembers +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +eastus myblockchainuvbqdl Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a subscription. + +### Example 2: List blockchain members +```powershell +PS C:\> Get-AzBlockchainMember -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command lists blockchain members under a resource group. + +### Example 3: Get a blockchain member +```powershell +PS C:\> Get-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +Location Name Type +-------- ---- ---- +eastus dolauli001 Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +### Example 4: Get a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -ResourceGroupName blockchain-rg -Name myblockchaine0f3ol +PS C:\> Get-AzBlockchainMember -InputObject $membe + +Location Name Type +-------- ---- ---- +eastus myblockchaine0f3ol Microsoft.Blockchain/blockchainMembers +``` + +This command gets a blockchain member under a resource group. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List, List1 +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md b/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..c1b8c31f0e4d --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMemberApiKey.md @@ -0,0 +1,146 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberapikey +schema: 2.0.0 +--- + +# Get-AzBlockchainMemberApiKey + +## SYNOPSIS +Lists the API keys for a blockchain member. + +## SYNTAX + +``` +Get-AzBlockchainMemberApiKey -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Lists the API keys for a blockchain member. + +## EXAMPLES + +### Example 1: List blockchain Api keys +```powershell +PS C:\> Get-AzBlockchainMemberApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +KeyName Value +------- ----- +key1 72_8u5HPZJxtZmtvm4Y4W9o- +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command lists Api keys for a blockchain member. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md b/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md new file mode 100644 index 000000000000..506848d9bef3 --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainMemberConsortiumMember.md @@ -0,0 +1,114 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainmemberconsortiummember +schema: 2.0.0 +--- + +# Get-AzBlockchainMemberConsortiumMember + +## SYNOPSIS +Lists the consortium members for a blockchain member. + +## SYNTAX + +``` +Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the consortium members for a blockchain member. + +## EXAMPLES + +### Example 1: Lists the consortium members for a blockchain member. +```powershell +PS C:\> Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +DateModified DisplayName JoinDate Name Role Status SubscriptionId +------------ ----------- -------- ---- ---- ------ -------------- +11/19/2019 5:14:41 AM dolauli001 11/19/2019 5:01:20 AM dolauli001 ADMIN Ready c9cbd920-c00c-427c-852b-8aaf38badaeb +``` + +This command lists the consortium members for a blockchain member. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IConsortiumMember + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainSku.md b/src/Blockchain/help/Get-AzBlockchainSku.md new file mode 100644 index 000000000000..15652df8229d --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainSku.md @@ -0,0 +1,79 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainsku +schema: 2.0.0 +--- + +# Get-AzBlockchainSku + +## SYNOPSIS +Lists the Skus of the resource type. + +## SYNTAX + +``` +Get-AzBlockchainSku [-SubscriptionId ] [-DefaultProfile ] [] +``` + +## DESCRIPTION +Lists the Skus of the resource type. + +## EXAMPLES + +### Example 1: List SKU for a subscription +```powershell +PS C:\> Get-AzBlockchainSku -SubscriptionId c9cbd920-c00c-427c-852b-8aaf38badaeb + +``` + +This command lists SKU for a subscription. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceTypeSku + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainTransactionNode.md b/src/Blockchain/help/Get-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..02754d61927a --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainTransactionNode.md @@ -0,0 +1,197 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Get-AzBlockchainTransactionNode + +## SYNOPSIS +Get the details of the transaction node. + +## SYNTAX + +### List (Default) +``` +Get-AzBlockchainTransactionNode -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### Get +``` +Get-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [] +``` + +### GetViaIdentity +``` +Get-AzBlockchainTransactionNode -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the details of the transaction node. + +## EXAMPLES + +### Example 1: List transaction nodes for a blockchain member +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command lists transaction nodes for a blockchain member. + +### Example 2: Get a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +### Example 3: Get a transaction node +```powershell +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -Name tranctionnode001 +PS C:\>Get-AzBlockchainTransactionNode -InputObject $tNode + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command gets a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: GetViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: Get +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Get, List +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: Get, List +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..381dd3cafe80 --- /dev/null +++ b/src/Blockchain/help/Get-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,162 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchaintransactionnodeapikey +schema: 2.0.0 +--- + +# Get-AzBlockchainTransactionNodeApiKey + +## SYNOPSIS +List the API keys for the transaction node. + +## SYNTAX + +``` +Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName -ResourceGroupName + -TransactionNodeName [-SubscriptionId ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +List the API keys for the transaction node. + +## EXAMPLES + +### Example 1: List Api keys for a transaction node +```powershell +PS C:\> Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 + +KeyName Value +------- ----- +key1 H4_GPhxbqYENxwas4Vc4l5U9 +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command lists Api keys for a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TransactionNodeName +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainMember.md b/src/Blockchain/help/New-AzBlockchainMember.md new file mode 100644 index 000000000000..9b920098d6d7 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainMember.md @@ -0,0 +1,372 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +schema: 2.0.0 +--- + +# New-AzBlockchainMember + +## SYNOPSIS +Create a blockchain member. + +## SYNTAX + +``` +New-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-Consortium ] [-ConsortiumManagementAccountPassword ] + [-ConsortiumMemberDisplayName ] [-ConsortiumRole ] [-FirewallRule ] + [-Location ] [-Password ] [-Protocol ] [-Sku ] + [-SkuTier ] [-Tag ] [-ValidatorNodeSkuCapacity ] [-DefaultProfile ] + [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create a blockchain member. + +## EXAMPLES + +### Example 1: Create a new blockchain member +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command creates a new blockchain member. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Consortium +Gets or sets the consortium for the blockchain member. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumManagementAccountPassword +Sets the managed consortium management account password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumMemberDisplayName +Gets the display name of the member in the consortium. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ConsortiumRole +Gets the role of the member in the consortium. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets firewall rules +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The GEO location of the blockchain service. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the basic auth password of the blockchain member. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Protocol +Gets or sets the blockchain protocol. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +Gets or sets Sku name + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SkuTier +Gets or sets Sku tier + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Tags of the service which is a list of key value pairs that describes the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ValidatorNodeSkuCapacity +Gets or sets the nodes capacity. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets firewall rules + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainMemberApiKey.md b/src/Blockchain/help/New-AzBlockchainMemberApiKey.md new file mode 100644 index 000000000000..c5994f769cae --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainMemberApiKey.md @@ -0,0 +1,231 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmemberapikey +schema: 2.0.0 +--- + +# New-AzBlockchainMemberApiKey + +## SYNOPSIS +Regenerate the API keys for a blockchain member. + +## SYNTAX + +### RegenerateExpanded (Default) +``` +New-AzBlockchainMemberApiKey -BlockchainMemberName -ResourceGroupName + [-SubscriptionId ] [-KeyName ] [-Value ] [-DefaultProfile ] [-Confirm] + [-WhatIf] [] +``` + +### RegenerateViaIdentityExpanded +``` +New-AzBlockchainMemberApiKey -InputObject [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Regenerate the API keys for a blockchain member. + +## EXAMPLES + +### Example 1: Regenerate Api keys for a blockchain member using name +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 D7wyajHMZcBw4MndMgytqanz +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member using name, resource group. + +### Example 2: Regenerate Api keys for a blockchain member using idenity +```powershell +PS C:\> $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> $bcMember = Get-AzBlockchainMember -Name myblockchainhlqc92 -ResourceGroupName bc-rg +PS C:\> New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 DdsyaaHsdasd46asd8Bw4Mnd +key2 eu9kx94TKH506R0i4JhYBmsx +``` + +This command regenerates Api keys for a blockchain member using identity. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: RegenerateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyName +Gets or sets the API key name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Gets or sets the API key value. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainTransactionNode.md b/src/Blockchain/help/New-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..149cfbd05b69 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainTransactionNode.md @@ -0,0 +1,248 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +schema: 2.0.0 +--- + +# New-AzBlockchainTransactionNode + +## SYNOPSIS +Create or update the transaction node. + +## SYNTAX + +``` +New-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-FirewallRule ] [-Location ] [-Password ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Create or update the transaction node. + +## EXAMPLES + +### Example 1: Create a blockchain transaction node +```powershell +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command creates a blockchain transaction node. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Gets or sets the transaction node location. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +## RELATED LINKS + diff --git a/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md b/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md new file mode 100644 index 000000000000..ea6f709d1ab0 --- /dev/null +++ b/src/Blockchain/help/New-AzBlockchainTransactionNodeApiKey.md @@ -0,0 +1,246 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnodeapikey +schema: 2.0.0 +--- + +# New-AzBlockchainTransactionNodeApiKey + +## SYNOPSIS +Regenerate the API keys for the blockchain member. + +## SYNTAX + +### RegenerateExpanded (Default) +``` +New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName -ResourceGroupName + -TransactionNodeName [-SubscriptionId ] [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### RegenerateViaIdentityExpanded +``` +New-AzBlockchainTransactionNodeApiKey -InputObject [-KeyName ] [-Value ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Regenerate the API keys for the blockchain member. + +## EXAMPLES + +### Example 1: Regenerate Api keys for a transaction node using name. +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node using name, resource group. + +### Example 2: Regenerate Api keys for a transaction node +```powershell +PS C:\> $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -ResourceGroupName testgroup -TransactionNodeName tranctionnode001 +PS C:\> New-AzBlockchainTransactionNodeApiKey -InputObject $tNode -KeyName $keyPair[0].KeyName + +KeyName Value +------- ----- +key1 0-UCaNSNfS0lwRKRyv09sgb- +key2 0Prk4Dl3lsOKdhyPEFQ-AnQb +``` + +This command generates Api keys for a transaction node using idenity. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: RegenerateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyName +Gets or sets the API key name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -TransactionNodeName +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: RegenerateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Value +Gets or sets the API key value. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IApiKey + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Remove-AzBlockchainMember.md b/src/Blockchain/help/Remove-AzBlockchainMember.md new file mode 100644 index 000000000000..2b92b137a584 --- /dev/null +++ b/src/Blockchain/help/Remove-AzBlockchainMember.md @@ -0,0 +1,235 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchainmember +schema: 2.0.0 +--- + +# Remove-AzBlockchainMember + +## SYNOPSIS +Delete a blockchain member. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +### DeleteViaIdentity +``` +Remove-AzBlockchainMember -InputObject [-DefaultProfile ] [-AsJob] [-NoWait] + [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete a blockchain member. + +## EXAMPLES + +### Example 1: Remove a blockchain member +```powershell +PS C:\> Remove-AzBlockchainMember -Name dolauli001 -ResourceGroupName testgroup + +``` + +This command removes a blockchain member. + +### Example 2: Remove a blockchain member +```powershell +PS C:\> $member = Get-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup +PS C:\> Remove-AzBlockchainMember -InputObject $member + +``` + +This command removes a blockchain member. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md b/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..6fe17e1154a2 --- /dev/null +++ b/src/Blockchain/help/Remove-AzBlockchainTransactionNode.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/remove-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Remove-AzBlockchainTransactionNode + +## SYNOPSIS +Delete the transaction node. + +## SYNTAX + +### Delete (Default) +``` +Remove-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-Confirm] [-WhatIf] + [] +``` + +### DeleteViaIdentity +``` +Remove-AzBlockchainTransactionNode -InputObject [-DefaultProfile ] [-AsJob] + [-NoWait] [-PassThru] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Delete the transaction node. + +## EXAMPLES + +### Example 1: Remove a transaction node +```powershell +PS C:\> Remove-AzBlockchainTransactionNode -Name transacnode002 -BlockchainMemberName dolauli002 -ResourceGroupName testgroup + +``` + +This command removes a transaction node. + +### Example 2: Remove a transaction node +```powershell +PS C:\> $node = Get-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode003 -ResourceGroupName $env.resourceGroup +PS C:\> Remove-AzBlockchainTransactionNode -InputObject $node +``` + +This command removes a transaction node. + +## PARAMETERS + +### -AsJob +Run the command as a job + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: DeleteViaIdentity +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -NoWait +Run the command asynchronously + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true when the command succeeds + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: Delete +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### System.Boolean + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md b/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md new file mode 100644 index 000000000000..e47d13dc95e0 --- /dev/null +++ b/src/Blockchain/help/Test-AzBlockchainLocationNameAvailability.md @@ -0,0 +1,170 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/test-azblockchainlocationnameavailability +schema: 2.0.0 +--- + +# Test-AzBlockchainLocationNameAvailability + +## SYNOPSIS +To check whether a resource name is available. + +## SYNTAX + +``` +Test-AzBlockchainLocationNameAvailability -Location [-SubscriptionId ] [-Name ] + [-Type ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +To check whether a resource name is available. + +## EXAMPLES + +### Example 1: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name erw123 -type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ + True NotSpecified +``` + +The command checks whether a resource name is available. + +### Example 2: Check whether a resource name is available +```powershell +PS C:\> Test-AzBlockchainLocationNameAvailability -Location eastus -Name 123 -Type Microsoft.Blockchain/blockchainMembers + +Message NameAvailable Reason +------- ------------- ------ +The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long. False Invalid +``` + +The command checks whether a resource name is available. + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +Location Name. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +Gets or sets the name to check. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Type +Gets or sets the type of the resource to check. + +```yaml +Type: System.String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.INameAvailability + +## NOTES + +ALIASES + +## RELATED LINKS + diff --git a/src/Blockchain/help/Update-AzBlockchainMember.md b/src/Blockchain/help/Update-AzBlockchainMember.md new file mode 100644 index 000000000000..412fa0bed850 --- /dev/null +++ b/src/Blockchain/help/Update-AzBlockchainMember.md @@ -0,0 +1,268 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +schema: 2.0.0 +--- + +# Update-AzBlockchainMember + +## SYNOPSIS +Update a blockchain member. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzBlockchainMember -Name -ResourceGroupName [-SubscriptionId ] + [-ConsortiumManagementAccountPassword ] [-FirewallRule ] + [-Password ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzBlockchainMember -InputObject + [-ConsortiumManagementAccountPassword ] [-FirewallRule ] + [-Password ] [-Tag ] [-DefaultProfile ] [-Confirm] [-WhatIf] + [] +``` + +## DESCRIPTION +Update a blockchain member. + +## EXAMPLES + +### Example 1: Update a blockchain member +```powershell +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +### Example 2: Update a blockchain member +```powershell +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +``` + +This command updates a blockchain member. + +## PARAMETERS + +### -ConsortiumManagementAccountPassword +Sets the managed consortium management account password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: BlockchainMemberName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +Tags of the service which is a list of key value pairs that describes the resource. + +```yaml +Type: System.Collections.Hashtable +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/help/Update-AzBlockchainTransactionNode.md b/src/Blockchain/help/Update-AzBlockchainTransactionNode.md new file mode 100644 index 000000000000..3b2094ec4c8c --- /dev/null +++ b/src/Blockchain/help/Update-AzBlockchainTransactionNode.md @@ -0,0 +1,250 @@ +--- +external help file: +Module Name: Az.Blockchain +online version: https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +schema: 2.0.0 +--- + +# Update-AzBlockchainTransactionNode + +## SYNOPSIS +Update the transaction node. + +## SYNTAX + +### UpdateExpanded (Default) +``` +Update-AzBlockchainTransactionNode -BlockchainMemberName -Name -ResourceGroupName + [-SubscriptionId ] [-FirewallRule ] [-Password ] + [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +### UpdateViaIdentityExpanded +``` +Update-AzBlockchainTransactionNode -InputObject [-FirewallRule ] + [-Password ] [-DefaultProfile ] [-Confirm] [-WhatIf] [] +``` + +## DESCRIPTION +Update the transaction node. + +## EXAMPLES + +### Example 1: Update a transcation node +```powershell +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +### Example 2: Update a transcation node +```powershell +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +``` + +This command updates a transaction node. + +## PARAMETERS + +### -BlockchainMemberName +Blockchain member name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: System.Management.Automation.PSObject +Parameter Sets: (All) +Aliases: AzureRMContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -FirewallRule +Gets or sets the firewall rules. +To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[] +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +Identity Parameter +To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + +```yaml +Type: Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +Parameter Sets: UpdateViaIdentityExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Transaction node name. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: TransactionNodeName + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Password +Sets the transaction node dns endpoint basic auth password. + +```yaml +Type: System.Security.SecureString +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The name of the resource group that contains the resource. +You can obtain this value from the Azure Resource Manager API or the portal. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SubscriptionId +Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. +The subscription ID is part of the URI for every service call. + +```yaml +Type: System.String +Parameter Sets: UpdateExpanded +Aliases: + +Required: False +Position: Named +Default value: (Get-AzContext).Subscription.Id +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity + +## OUTPUTS + +### Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode + +## NOTES + +ALIASES + +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + + +FIREWALLRULE : Gets or sets the firewall rules. + - `[EndIPAddress ]`: Gets or sets the end IP address of the firewall rule range. + - `[RuleName ]`: Gets or sets the name of the firewall rules. + - `[StartIPAddress ]`: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + - `[BlockchainMemberName ]`: Blockchain member name. + - `[Id ]`: Resource identity path + - `[Location ]`: Location Name. + - `[OperationId ]`: Operation Id. + - `[ResourceGroupName ]`: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + - `[SubscriptionId ]`: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + - `[TransactionNodeName ]`: Transaction node name. + +## RELATED LINKS + diff --git a/src/Blockchain/how-to.md b/src/Blockchain/how-to.md new file mode 100644 index 000000000000..e939c07b9e49 --- /dev/null +++ b/src/Blockchain/how-to.md @@ -0,0 +1,58 @@ +# How-To +This document describes how to develop for `Az.Blockchain`. + +## Building `Az.Blockchain` +To build, run the `build-module.ps1` at the root of the module directory. This will generate the proxy script cmdlets that are the cmdlets being exported by this module. After the build completes, the proxy script cmdlets will be output to the `exports` folder. To read more about the proxy script cmdlets, look at the [readme.md](exports/readme.md) in the `exports` folder. + +## Creating custom cmdlets +To add cmdlets that were not generated by the REST specification, use the `custom` folder. This folder allows you to add handwritten `.ps1` and `.cs` files. Currently, we support using `.ps1` scripts as new cmdlets or as additional low-level variants (via `ParameterSet`), and `.cs` files as low-level (variants) cmdlets that the exported script cmdlets call. We do not support exporting any `.cs` (dll) cmdlets directly. To read more about custom cmdlets, look at the [readme.md](custom/readme.md) in the `custom` folder. + +## Generating documentation +To generate documentation, the process is now integrated into the `build-module.ps1` script. If you don't want to run this process as part of `build-module.ps1`, you can provide the `-NoDocs` switch. If you want to run documentation generation after the build process, you may still run the `generate-help.ps1` script. Overall, the process will look at the documentation comments in the generated and custom cmdlets and types, and create `.md` files into the `docs` folder. Additionally, this pulls in any examples from the `examples` folder and adds them to the generated help markdown documents. To read more about examples, look at the [readme.md](examples/readme.md) in the `examples` folder. To read more about documentation, look at the [readme.md](docs/readme.md) in the `docs` folder. + +## Testing `Az.Blockchain` +To test the cmdlets, we use [Pester](https://github.com/pester/Pester). Tests scripts (`.ps1`) should be added to the `test` folder. To execute the Pester tests, run the `test-module.ps1` script. This will run all tests in `playback` mode within the `test` folder. To read more about testing cmdlets, look at the [readme.md](examples/readme.md) in the `examples` folder. + +## Packing `Az.Blockchain` +To pack `Az.Blockchain` for distribution, run the `pack-module.ps1` script. This will take the contents of multiple directories and certain root-folder files to create a `.nupkg`. The structure of the `.nupkg` is created so it can be loaded part of a [PSRepository](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository). Additionally, this package is in a format for distribution to the [PSGallery](https://www.powershellgallery.com/). For signing an Azure module, please contact the [Azure PowerShell](https://github.com/Azure/azure-powershell) team. + +## Module Script Details +There are multiple scripts created for performing different actions for developing `Az.Blockchain`. +- `build-module.ps1` + - Builds the module DLL (`./bin/Az.Blockchain.private.dll`), creates the exported cmdlets and documentation, generates custom cmdlet test stubs and exported cmdlet example stubs, and updates `./Az.Blockchain.psd1` with Azure profile information. + - **Parameters**: [`Switch` parameters] + - `-Run`: After building, creates an isolated PowerShell session and loads `Az.Blockchain`. + - `-Test`: After building, runs the `Pester` tests defined in the `test` folder. + - `-Docs`: After building, generates the Markdown documents for the modules into the `docs` folder. + - `-Pack`: After building, packages the module into a `.nupkg`. + - `-Code`: After building, opens a VSCode window with the module's directory and runs (see `-Run`) the module. + - `-Release`: Builds the module in `Release` configuration (as opposed to `Debug` configuration). + - `-NoDocs`: Supresses writing the documentation markdown files as part of the cmdlet exporting process. + - `-Debugger`: Used when attaching the debugger in Visual Studio to the PowerShell session, and running the build process without recompiling the DLL. This suppresses running the script as an isolated process. +- `run-module.ps1` + - Creates an isolated PowerShell session and loads `Az.Blockchain` into the session. + - Same as `-Run` in `build-module.ps1`. + - **Parameters**: [`Switch` parameters] + - `-Code`: Opens a VSCode window with the module's directory. + - Same as `-Code` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. +- `test-module.ps1` + - Runs the `Pester` tests defined in the `test` folder. + - Same as `-Test` in `build-module.ps1`. +- `pack-module.ps1` + - Packages the module into a `.nupkg` for distribution. + - Same as `-Pack` in `build-module.ps1`. +- `generate-help.ps1` + - Generates the Markdown documents for the modules into the `docs` folder. + - Same as `-Docs` in `build-module.ps1`. + - This process is now integrated into `build-module.ps1` automatically. To disable, use `-NoDocs` when running `build-module.ps1`. +- `export-surface.ps1` + - Generates Markdown documents for both the cmdlet surface and the model (class) surface of the module. + - These files are placed into the `resources` folder. + - Used for investigating the surface of your module. These are *not* documentation for distribution. +- `check-dependencies.ps1` + - Used in `run-module.ps1` and `test-module.ps1` to verify dependent modules are available to run those tasks. + - It will download local (within the module's directory structure) versions of those modules as needed. + - This script *does not* need to be ran by-hand. \ No newline at end of file diff --git a/src/Blockchain/internal/Az.Blockchain.internal.psm1 b/src/Blockchain/internal/Az.Blockchain.internal.psm1 new file mode 100644 index 000000000000..4c9927e3fa9f --- /dev/null +++ b/src/Blockchain/internal/Az.Blockchain.internal.psm1 @@ -0,0 +1,38 @@ +# region Generated + # Load the private module dll + $null = Import-Module -PassThru -Name (Join-Path $PSScriptRoot '..\bin\Az.Blockchain.private.dll') + + # Get the private module's instance + $instance = [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Module]::Instance + + # Export nothing to clear implicit exports + Export-ModuleMember + + # Export proxy cmdlet scripts + $exportsPath = $PSScriptRoot + $directories = Get-ChildItem -Directory -Path $exportsPath + $profileDirectory = $null + if($instance.ProfileName) { + if(($directories | ForEach-Object { $_.Name }) -contains $instance.ProfileName) { + $profileDirectory = $directories | Where-Object { $_.Name -eq $instance.ProfileName } + } else { + # Don't export anything if the profile doesn't exist for the module + $exportsPath = $null + Write-Warning "Selected Azure profile '$($instance.ProfileName)' does not exist for module '$($instance.Name)'. No cmdlets were loaded." + } + } elseif(($directories | Measure-Object).Count -gt 0) { + # Load the last folder if no profile is selected + $profileDirectory = $directories | Select-Object -Last 1 + } + + if($profileDirectory) { + Write-Information "Loaded Azure profile '$($profileDirectory.Name)' for module '$($instance.Name)'" + $exportsPath = $profileDirectory.FullName + } + + if($exportsPath) { + Get-ChildItem -Path $exportsPath -Recurse -Include '*.ps1' -File | ForEach-Object { . $_.FullName } + $cmdletNames = Get-ScriptCmdlet -ScriptFolder $exportsPath + Export-ModuleMember -Function $cmdletNames -Alias (Get-ScriptCmdlet -ScriptFolder $exportsPath -AsAlias) + } +# endregion diff --git a/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 b/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 new file mode 100644 index 000000000000..5e5fbc4e6abc --- /dev/null +++ b/src/Blockchain/internal/Get-AzBlockchainOperation.ps1 @@ -0,0 +1,121 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available operations of Microsoft.Blockchain resource provider. +.Description +Lists the available operations of Microsoft.Blockchain resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainoperation +#> +function Get-AzBlockchainOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/New-AzBlockchainMember.ps1 b/src/Blockchain/internal/New-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..047bfc392a13 --- /dev/null +++ b/src/Blockchain/internal/New-AzBlockchainMember.ps1 @@ -0,0 +1,242 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${SkuName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainMember_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 b/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..ef880d4edb3d --- /dev/null +++ b/src/Blockchain/internal/New-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,191 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNode_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 b/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 new file mode 100644 index 000000000000..67fda322050e --- /dev/null +++ b/src/Blockchain/internal/ProxyCmdletDefinitions.ps1 @@ -0,0 +1,961 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Lists the available operations of Microsoft.Blockchain resource provider. +.Description +Lists the available operations of Microsoft.Blockchain resource provider. +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} +.Example +PS C:\> {{ Add code here }} + +{{ Add output here }} + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/get-azblockchainoperation +#> +function Get-AzBlockchainOperation { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IResourceProviderOperation])] +[CmdletBinding(DefaultParameterSetName='List', PositionalBinding=$false)] +param( + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + List = 'Az.Blockchain.private\Get-AzBlockchainOperation_List'; + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create a blockchain member. +.Description +Create a blockchain member. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Consortium consor002 -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets firewall rules + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchainmember +#> +function New-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the consortium for the blockchain member. + ${Consortium}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the display name of the member in the consortium. + ${ConsortiumMemberDisplayName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets the role of the member in the consortium. + ${ConsortiumRole}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets firewall rules + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # The GEO location of the blockchain service. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the basic auth password of the blockchain member. + ${Password}, + + [Parameter()] + [ArgumentCompleter([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol])] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Support.BlockchainProtocol] + # Gets or sets the blockchain protocol. + ${Protocol}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku name + ${SkuName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets Sku tier + ${SkuTier}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITrackedResourceTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.Int32] + # Gets or sets the nodes capacity. + ${ValidatorNodeSkuCapacity}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainMember_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Create or update the transaction node. +.Description +Create or update the transaction node. +.Example +PS C:\> $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> New-AzBlockchainTransactionNode -BlockchainMemberName dolauli001 -Name tranctionnode001 -ResourceGroupName testgroup -Location eastus -Password $passwd + +Name Type Location +---- ---- -------- +tranctionnode001 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/new-azblockchaintransactionnode +#> +function New-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='CreateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Gets or sets the transaction node location. + ${Location}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + CreateExpanded = 'Az.Blockchain.private\New-AzBlockchainTransactionNode_CreateExpanded'; + } + if (('CreateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/Update-AzBlockchainMember.ps1 b/src/Blockchain/internal/Update-AzBlockchainMember.ps1 new file mode 100644 index 000000000000..447574250ef3 --- /dev/null +++ b/src/Blockchain/internal/Update-AzBlockchainMember.ps1 @@ -0,0 +1,207 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update a blockchain member. +.Description +Update a blockchain member. +.Example +PS C:\> $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force +PS C:\> Update-AzBlockchainMember -Name dolauli002 -ResourceGroupName testgroup -Password $passwd2 + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers +.Example +PS C:\> $tag = @{'againupdate'='password'} +PS C:\> $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup +PS C:\> Update-AzBlockchainMember -InputObject $member -Tag $tag + +Location Name Type +-------- ---- ---- +eastus dolauli002 Microsoft.Blockchain/blockchainMembers + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchainmember +#> +function Update-AzBlockchainMember { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMember])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('BlockchainMemberName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the managed consortium management account password. + ${ConsortiumManagementAccountPassword}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IBlockchainMemberUpdateTags]))] + [System.Collections.Hashtable] + # Tags of the service which is a list of key value pairs that describes the resource. + ${Tag}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainMember_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 b/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 new file mode 100644 index 000000000000..6a9853daf5a0 --- /dev/null +++ b/src/Blockchain/internal/Update-AzBlockchainTransactionNode.ps1 @@ -0,0 +1,200 @@ + +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- + +<# +.Synopsis +Update the transaction node. +.Description +Update the transaction node. +.Example +PS C:\> $tag = @{'key1'='update'} +PS C:\> Update-AzBlockchainTransactionNode -BlockchainMemberName dolauli002 -Name transacnode002 -ResourceGroupName testgroup -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus +.Example +PS C:\> $tag = @{'key2'='update'} +PS C:\> $tNode = Get-AzBlockchainMember -BlockchainMemberName dolauli002 -ResourceGroupName testgroup -Name transacnode002 +PS C:\> Update-AzBlockchainTransactionNode -InputObject $tNode -Tag $tag + +Name Type Location +---- ---- -------- +transacnode002 Microsoft.Blockchain/blockchainMembers/transactionNodes eastus + +.Inputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity +.Outputs +Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode +.Notes +COMPLEX PARAMETER PROPERTIES + +To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. + +FIREWALLRULE : Gets or sets the firewall rules. + [EndIPAddress ]: Gets or sets the end IP address of the firewall rule range. + [RuleName ]: Gets or sets the name of the firewall rules. + [StartIPAddress ]: Gets or sets the start IP address of the firewall rule range. + +INPUTOBJECT : Identity Parameter + [BlockchainMemberName ]: Blockchain member name. + [Id ]: Resource identity path + [Location ]: Location Name. + [OperationId ]: Operation Id. + [ResourceGroupName ]: The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + [SubscriptionId ]: Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part of the URI for every service call. + [TransactionNodeName ]: Transaction node name. +.Link +https://docs.microsoft.com/en-us/powershell/module/az.blockchain/update-azblockchaintransactionnode +#> +function Update-AzBlockchainTransactionNode { +[OutputType([Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.ITransactionNode])] +[CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] +param( + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Blockchain member name. + ${BlockchainMemberName}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Alias('TransactionNodeName')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # Transaction node name. + ${Name}, + + [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [System.String] + # The name of the resource group that contains the resource. + # You can obtain this value from the Azure Resource Manager API or the portal. + ${ResourceGroupName}, + + [Parameter(ParameterSetName='UpdateExpanded')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] + [System.String] + # Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. + # The subscription ID is part of the URI for every service call. + ${SubscriptionId}, + + [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Path')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.IBlockchainIdentity] + # Identity Parameter + # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. + ${InputObject}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Models.Api20180601Preview.IFirewallRule[]] + # Gets or sets the firewall rules. + # To construct, see NOTES section for FIREWALLRULE properties and create a hash table. + ${FirewallRule}, + + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Body')] + [System.String] + # Sets the transaction node dns endpoint basic auth password. + ${Password}, + + [Parameter()] + [Alias('AzureRMContext', 'AzureCredential')] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Azure')] + [System.Management.Automation.PSObject] + # The credentials, account, tenant, and subscription used for communication with Azure. + ${DefaultProfile}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Wait for .NET debugger to attach + ${Break}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be appended to the front of the pipeline + ${HttpPipelineAppend}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Runtime.SendAsyncStep[]] + # SendAsync Pipeline Steps to be prepended to the front of the pipeline + ${HttpPipelinePrepend}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Uri] + # The URI for the proxy server to use + ${Proxy}, + + [Parameter(DontShow)] + [ValidateNotNull()] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.PSCredential] + # Credentials for a proxy server to use for the remote call + ${ProxyCredential}, + + [Parameter(DontShow)] + [Microsoft.Azure.PowerShell.Cmdlets.Blockchain.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Use the default credentials for the proxy + ${ProxyUseDefaultCredentials} +) + +begin { + try { + $outBuffer = $null + if ($PSBoundParameters.TryGetValue('OutBuffer', [ref]$outBuffer)) { + $PSBoundParameters['OutBuffer'] = 1 + } + $parameterSet = $PSCmdlet.ParameterSetName + $mapping = @{ + UpdateExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateExpanded'; + UpdateViaIdentityExpanded = 'Az.Blockchain.private\Update-AzBlockchainTransactionNode_UpdateViaIdentityExpanded'; + } + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId')) { + $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id + } + $wrappedCmd = $ExecutionContext.InvokeCommand.GetCommand(($mapping[$parameterSet]), [System.Management.Automation.CommandTypes]::Cmdlet) + $scriptCmd = {& $wrappedCmd @PSBoundParameters} + $steppablePipeline = $scriptCmd.GetSteppablePipeline($MyInvocation.CommandOrigin) + $steppablePipeline.Begin($PSCmdlet) + } catch { + throw + } +} + +process { + try { + $steppablePipeline.Process($_) + } catch { + throw + } +} + +end { + try { + $steppablePipeline.End() + } catch { + throw + } +} +} diff --git a/src/Blockchain/internal/readme.md b/src/Blockchain/internal/readme.md new file mode 100644 index 000000000000..cd05b500991f --- /dev/null +++ b/src/Blockchain/internal/readme.md @@ -0,0 +1,14 @@ +# Internal +This directory contains a module to handle *internal only* cmdlets. Cmdlets that you **hide** in configuration are created here. For more information on hiding, see [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression). The cmdlets in this directory are generated at **build-time**. Do not put any custom code, files, cmdlets, etc. into this directory. Please use `..\custom` for all custom implementation. + +## Info +- Modifiable: no +- Generated: all +- Committed: no +- Packaged: yes + +## Details +The `Az.Blockchain.internal.psm1` file is generated to this folder. This module file handles the hidden cmdlets. These cmdlets will not be exported by `Az.Blockchain`. Instead, this sub-module is imported by the `..\custom\Az.Blockchain.custom.psm1` module, allowing you to use hidden cmdlets in your custom, exposed cmdlets. To call these cmdlets in your custom scripts, simply use [module-qualified calls](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_command_precedence?view=powershell-6#qualified-names). For example, `Az.Blockchain.internal\Get-Example` would call an internal cmdlet named `Get-Example`. + +## Purpose +This allows you to include REST specifications for services that you *do not wish to expose from your module*, but simply want to call within custom cmdlets. For example, if you want to make a custom cmdlet that uses `Storage` services, you could include a simplified `Storage` REST specification that has only the operations you need. When you run the generator and build this module, note the generated `Storage` cmdlets. Then, in your readme configuration, use [cmdlet hiding](https://github.com/Azure/autorest/blob/master/docs/powershell/options.md#cmdlet-hiding-exportation-suppression) on the `Storage` cmdlets and they will *only be exposed to the custom cmdlets* you want to write, and not be exported as part of `Az.Blockchain`. \ No newline at end of file diff --git a/src/Blockchain/pack-module.ps1 b/src/Blockchain/pack-module.ps1 new file mode 100644 index 000000000000..c22fad33d87b --- /dev/null +++ b/src/Blockchain/pack-module.ps1 @@ -0,0 +1,16 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +Write-Host -ForegroundColor Green 'Packing module...' +dotnet pack $PSScriptRoot --no-build /nologo +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/readme.md b/src/Blockchain/readme.md new file mode 100644 index 000000000000..aeec4b30d625 --- /dev/null +++ b/src/Blockchain/readme.md @@ -0,0 +1,121 @@ + +# Az.Blockchain +This directory contains the PowerShell module for the Blockchain service. + +--- +## Status +[![Az.Blockchain](https://img.shields.io/powershellgallery/v/Az.Blockchain.svg?style=flat-square&label=Az.Blockchain "Az.Blockchain")](https://www.powershellgallery.com/packages/Az.Blockchain/) + +## Info +- Modifiable: yes +- Generated: all +- Committed: yes +- Packaged: yes + +--- +## Detail +This module was primarily generated via [AutoRest](https://github.com/Azure/autorest) using the [PowerShell](https://github.com/Azure/autorest.powershell) extension. + +## Module Requirements +- [Az.Accounts module](https://www.powershellgallery.com/packages/Az.Accounts/), version 1.7.4 or greater + +## Authentication +AutoRest does not generate authentication code for the module. Authentication is handled via Az.Accounts by altering the HTTP payload before it is sent. + +## Development +For information on how to develop for `Az.Blockchain`, see [how-to.md](how-to.md). + + +--- +## Generation Requirements +Use of the beta version of `autorest.powershell` generator requires the following: +- [NodeJS LTS](https://nodejs.org) (10.15.x LTS preferred) + - **Note**: It *will not work* with Node < 10.x. Using 11.x builds may cause issues as they may introduce instability or breaking changes. +> If you want an easy way to install and update Node, [NVS - Node Version Switcher](../nodejs/installing-via-nvs.md) or [NVM - Node Version Manager](../nodejs/installing-via-nvm.md) is recommended. +- [AutoRest](https://aka.ms/autorest) v3 beta
`npm install -g autorest@beta`
  +- PowerShell 6.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g pwsh`
  +- .NET Core SDK 2.0 or greater + - If you don't have it installed, you can use the cross-platform npm package
`npm install -g dotnet-sdk-2.2`
  + +## Run Generation +In this directory, run AutoRest: +> `autorest` + +--- +### AutoRest Configuration +> see https://aka.ms/autorest + +``` yaml +require: + - $(this-folder)/../readme.azure.noprofile.md +input-file: + - $(repo)/specification/blockchain/resource-manager/Microsoft.Blockchain/preview/2018-06-01-preview/blockchain.json +module-version: 0.1.0 +title: Blockchain +subject-prefix: 'Blockchain' + +identity-correction-for-post: true + +directive: + - from: swagger-document + where: $.paths..operationId + transform: return $.replace(/ListRegenerateApiKeys$/, "RegenerateApiKeys") + - from: swagger-document + where: $ + transform: return $.replace(/locationName/g, "location") + - where: + subject: Operation + hide: true + - where: + subject: LocationConsortium + set: + subject: Consortium + - where: + subject: BlockchainMemberOperationResult + remove: true + # Should use verb 'New' for the two RegenateApiKey related APIs + - where: + subject: BlockchainMemberRegenerateApiKey + verb: Get + set: + verb: New + subject: BlockchainMemberApiKey + - where: + subject: TransactionNodeRegenerateApiKey + verb: Get + set: + verb: New + subject: TransactionNodeApiKey + # Drop the un-flattened parameter-set for Post/New/Set/Update related cmdlets. + - where: + subject: (.*)RegenerateApiKey$ + variant: List + remove: true + - where: + verb: Update + variant: ^Update$|^UpdateViaIdentity$ + remove: true + - where: + verb: New + variant: ^Create$|^CreateViaIdentity$|^CreateViaIdentityExpanded$|^Regenerate$|^RegenerateViaIdentity$ + remove: true + - where: + verb: Test + variant: ^Check$|^CheckViaIdentity$|^CheckViaIdentityExpanded$ + remove: true + # Hide these two cmdlets, because we need to customize a version with password secured. + - where: + verb: New|Update + subject: BlockchainMember + hide: true + - where: + verb: New|Update + subject: TransactionNode + hide: true + - where: + parameter-name: SubscriptionId + set: + default: + script: '(Get-AzContext).Subscription.Id' +``` diff --git a/src/Blockchain/run-module.ps1 b/src/Blockchain/run-module.ps1 new file mode 100644 index 000000000000..60d6a5e46f22 --- /dev/null +++ b/src/Blockchain/run-module.ps1 @@ -0,0 +1,59 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Code) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NoExit -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$isAzure = $true +if($isAzure) { + . (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +function Prompt { + Write-Host -NoNewline -ForegroundColor Green "PS $(Get-Location)" + Write-Host -NoNewline -ForegroundColor Gray ' [' + Write-Host -NoNewline -ForegroundColor White -BackgroundColor DarkCyan $moduleName + ']> ' +} + +# where we would find the launch.json file +$vscodeDirectory = New-Item -ItemType Directory -Force -Path (Join-Path $PSScriptRoot '.vscode') +$launchJson = Join-Path $vscodeDirectory 'launch.json' + +# if there is a launch.json file, let's just assume -Code, and update the file +if(($Code) -or (test-Path $launchJson) ) { + $launchContent = '{ "version": "0.2.0", "configurations":[{ "name":"Attach to PowerShell", "type":"coreclr", "request":"attach", "processId":"' + ([System.Diagnostics.Process]::GetCurrentProcess().Id) + '", "justMyCode":false }] }' + Set-Content -Path $launchJson -Value $launchContent + if($Code) { + # only launch vscode if they say -code + code $PSScriptRoot + } +} + +Import-Module -Name $modulePath \ No newline at end of file diff --git a/src/Blockchain/test-module.ps1 b/src/Blockchain/test-module.ps1 new file mode 100644 index 000000000000..6578dd134116 --- /dev/null +++ b/src/Blockchain/test-module.ps1 @@ -0,0 +1,68 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +param([switch]$Isolated, [switch]$Live, [switch]$Record, [switch]$Playback) +$ErrorActionPreference = 'Stop' + +if(-not $Isolated) { + Write-Host -ForegroundColor Green 'Creating isolated process...' + $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().Path + & "$pwsh" -NonInteractive -NoLogo -NoProfile -File $MyInvocation.MyCommand.Path @PSBoundParameters -Isolated + return +} + +$ProgressPreference = 'SilentlyContinue' +$baseName = $PSScriptRoot.BaseName +$requireResourceModule = (($baseName -ne "Resources") -and ($Record.IsPresent -or $Live.IsPresent)) +. (Join-Path $PSScriptRoot 'check-dependencies.ps1') -Isolated -Accounts:$false -Pester -Resources:$requireResourceModule +. ("$PSScriptRoot\test\utils.ps1") + +if ($requireResourceModule) { + $resourceModulePSD = Get-Item -Path (Join-Path $HOME '.PSSharedModules\Resources\Az.Resources.TestSupport.psd1') + Import-Module -Name $resourceModulePSD.FullName +} + +$localModulesPath = Join-Path $PSScriptRoot 'generated\modules' +if(Test-Path -Path $localModulesPath) { + $env:PSModulePath = "$localModulesPath$([IO.Path]::PathSeparator)$env:PSModulePath" +} + +$modulePsd1 = Get-Item -Path (Join-Path $PSScriptRoot './Az.Blockchain.psd1') +$modulePath = $modulePsd1.FullName +$moduleName = $modulePsd1.BaseName + +Import-Module -Name Pester +Import-Module -Name $modulePath + +$TestMode = 'playback' +if($Live) { + $TestMode = 'live' +} +if($Record) { + $TestMode = 'record' +} +try { + if ($TestMode -ne 'playback') { + setupEnv + } + $testFolder = Join-Path $PSScriptRoot 'test' + Invoke-Pester -Script @{ Path = $testFolder } -EnableExit -OutputFile (Join-Path $testFolder "$moduleName-TestResults.xml") +} +Finally +{ + if ($TestMode -ne 'playback') { + cleanupEnv + } +} + +Write-Host -ForegroundColor Green '-------------Done-------------' \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json b/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json new file mode 100644 index 000000000000..fae862e45ad2 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainConsortium.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainConsortium+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/listConsortiums?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/listConsortiums?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "59" ], + "x-ms-client-request-id": [ "de3d67c8-b4cf-45fe-a5b5-fac7405920c9" ], + "CommandName": [ "Get-AzBlockchainConsortium" ], + "FullCommandName": [ "Get-AzBlockchainConsortium_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1199" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "x-ms-correlation-request-id": [ "0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141125Z:0771205a-f969-41b1-8aa6-e562a65ec1c2" ], + "Date": [ "Thu, 21 May 2020 14:11:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "12" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 new file mode 100644 index 000000000000..fa1bb2a4bf09 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainConsortium.Tests.ps1 @@ -0,0 +1,20 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainConsortium.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainConsortium' { + It 'List' { + { + Get-AzBlockchainConsortium -Location eastus + } | Should -Not -Throw + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMember.Recording.json b/src/Blockchain/test/Get-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..b77a4be410b9 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMember.Recording.json @@ -0,0 +1,197 @@ +{ + "Get-AzBlockchainMember+[NoContext]+List1+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "60" ], + "x-ms-client-request-id": [ "6a553666-87b0-4286-8fad-c0a2f834376c" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List1" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11946" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "x-ms-correlation-request-id": [ "5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141126Z:5c507430-7072-4345-8b81-5f66bb9dc4c9" ], + "Date": [ "Thu, 21 May 2020 14:11:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2834" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainue7wvy\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainue7wvy\",\"password\":null,\"consortium\":\"consortiumue7wvy\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainue7wvy\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"RgNFxaESsjuCJSZ+IYW1/LBLMmV8J1C7F1wlxcqXNFE=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainue7wvy.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgroupue7wvy/providers/Microsoft.Blockchain/blockchainMembers/myblockchainue7wvy\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Get-AzBlockchainMember+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "61" ], + "x-ms-client-request-id": [ "8a76e9f3-4875-4edd-9036-c07c34e59eca" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11945" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "x-ms-correlation-request-id": [ "14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141126Z:14dd6aec-539c-48b4-9b25-528c6ab50f0f" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Get-AzBlockchainMember+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "62" ], + "x-ms-client-request-id": [ "ea6cf138-803b-4d6c-910d-8d3705a59c0b" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11944" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "x-ms-correlation-request-id": [ "754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141127Z:754be11e-6805-49b6-aa8b-70eca7fea8db" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1893" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Get-AzBlockchainMember+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "63" ], + "x-ms-client-request-id": [ "c4bd0719-007e-4da3-98d6-e9cd363d9c05" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11943" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "x-ms-correlation-request-id": [ "21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141127Z:21b45d65-b9c0-4b9e-9e62-a73cd2519e35" ], + "Date": [ "Thu, 21 May 2020 14:11:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Get-AzBlockchainMember+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "64" ], + "x-ms-client-request-id": [ "c1eeb01f-9a84-44da-a48f-03e54c5d57cf" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11942" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "152aa32a-03b8-4847-9646-a944d6acbe77" ], + "x-ms-correlation-request-id": [ "152aa32a-03b8-4847-9646-a944d6acbe77" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141128Z:152aa32a-03b8-4847-9646-a944d6acbe77" ], + "Date": [ "Thu, 21 May 2020 14:11:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..88ca3f3673c7 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,37 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMember' { + It 'List1' { + $bcMember = Get-AzBlockchainMember + $bcMember.Count | Should -BeGreaterOrEqual 2 + } + + It 'Get' { + $bcMember = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $bcMember.Name | Should -Be $env.blockchainMember + } + + It 'List' { + $bcMember = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMember.Count | Should -Be 2 + } + + It 'GetViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $member = Get-AzBlockchainMember -SubscriptionId $env.SubscriptionId -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $bcMember = Get-AzBlockchainMember -InputObject $member + $bcMember.Name | Should -Be $env.blockchainMember + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json new file mode 100644 index 000000000000..b96d81ff0ea9 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainMemberApiKey+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "65" ], + "x-ms-client-request-id": [ "57e46b19-0650-4b06-b986-6cb36251a29b" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1198" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "x-ms-correlation-request-id": [ "13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141128Z:13c5034c-7b37-44a6-bc07-3bbabe1352b5" ], + "Date": [ "Thu, 21 May 2020 14:11:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"8y6u3WirRR8jx1I25vLPYgvY\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 new file mode 100644 index 000000000000..17e017a00941 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberApiKey.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMemberApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMemberApiKey' { + It 'List' { + $memberKeys = Get-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $memberKeys.Count | Should -Be 2 + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json new file mode 100644 index 000000000000..9f6cc603a1a8 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainMemberConsortiumMember+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/consortiumMembers?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/consortiumMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "66" ], + "x-ms-client-request-id": [ "63ca3930-3b59-4e9d-90ed-730e5062d205" ], + "CommandName": [ "Get-AzBlockchainMemberConsortiumMember" ], + "FullCommandName": [ "Get-AzBlockchainMemberConsortiumMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11941" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "x-ms-correlation-request-id": [ "1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141129Z:1fb15f64-e917-4ee3-a4d7-85c0057fdec9" ], + "Date": [ "Thu, 21 May 2020 14:11:28 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "243" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"name\":\"myblockchainhv0x8n\",\"displayName\":\"myblockchainhv0x8n\",\"subscriptionId\":\"9e223dbe-3399-4e19-88eb-0975f02ac87f\",\"role\":\"ADMIN\",\"status\":\"Ready\",\"joinDate\":\"2020-05-21T13:46:13.0148402Z\",\"dateModified\":\"2020-05-21T13:54:40\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 new file mode 100644 index 000000000000..5e2bb996b7b0 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainMemberConsortiumMember.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainMemberConsortiumMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainMemberConsortiumMember' { + It 'List' { + $consortiums = Get-AzBlockchainMemberConsortiumMember -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $consortiums.Count | Should -Be 1 + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainSku.Recording.json b/src/Blockchain/test/Get-AzBlockchainSku.Recording.json new file mode 100644 index 000000000000..5726a9136439 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainSku.Recording.json @@ -0,0 +1,40 @@ +{ + "Get-AzBlockchainSku+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/skus?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/skus?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "67" ], + "x-ms-client-request-id": [ "8d513b78-7fd1-4e98-afda-8b153bc37747" ], + "CommandName": [ "Get-AzBlockchainSku" ], + "FullCommandName": [ "Get-AzBlockchainSku_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11940" ], + "x-ms-request-id": [ "e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "x-ms-correlation-request-id": [ "e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141129Z:e66047d3-6ea6-4645-82ea-2436530fdcf2" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "X-Content-Type-Options": [ "nosniff" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ], + "Content-Length": [ "12" ] + }, + "Content": "{\"value\":[]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 new file mode 100644 index 000000000000..53898fe63f48 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainSku.Tests.ps1 @@ -0,0 +1,18 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainSku.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainSku' { + It 'List' { + { Get-AzBlockchainSku } | Should -Not -Throw + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..5d3ce12aa3f5 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,158 @@ +{ + "Get-AzBlockchainTransactionNode+[NoContext]+List+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "68" ], + "x-ms-client-request-id": [ "436a30cc-3a00-4fdb-b423-678fe3b3bcd2" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11939" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "x-ms-correlation-request-id": [ "ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141130Z:ff4dd378-32b5-4f84-af01-0162c40fb20c" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1283" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"}]}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+Get+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "69" ], + "x-ms-client-request-id": [ "ee38d7c5-9cba-420a-9ea2-ad437d3c66ce" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11938" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "x-ms-correlation-request-id": [ "c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141130Z:c140f063-3b88-4f55-b0bc-b6a7c5b1c8de" ], + "Date": [ "Thu, 21 May 2020 14:11:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "70" ], + "x-ms-client-request-id": [ "f2d04a8c-fa5e-40cb-b0c9-69412caf4707" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11937" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "x-ms-correlation-request-id": [ "afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141131Z:afb32b2b-7cec-49c3-a002-0fac076e51d6" ], + "Date": [ "Thu, 21 May 2020 14:11:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Get-AzBlockchainTransactionNode+[NoContext]+GetViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "71" ], + "x-ms-client-request-id": [ "48ecf3d0-23c6-4f08-b35d-3142f5ff4099" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_GetViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11936" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "15367c70-b16a-4e4d-85ab-87683991843e" ], + "x-ms-correlation-request-id": [ "15367c70-b16a-4e4d-85ab-87683991843e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141131Z:15367c70-b16a-4e4d-85ab-87683991843e" ], + "Date": [ "Thu, 21 May 2020 14:11:30 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..e873f529ba32 --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainTransactionNode' { + It 'List' { + $tNodes = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodes.Count | Should -Be 2 + } + + It 'Get' { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + $tNode.Name | Should -Be $env.blockchainTransactionNode + } + + It 'GetViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + $tNode = Get-AzBlockchainTransactionNode -InputObject $tNode + $tNode.Name | Should -Be $env.blockchainTransactionNode + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json new file mode 100644 index 000000000000..83bbda48db7c --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Recording.json @@ -0,0 +1,41 @@ +{ + "Get-AzBlockchainTransactionNodeApiKey+[NoContext]+List+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "72" ], + "x-ms-client-request-id": [ "f748e0cd-b745-4926-9871-f4e053d8cc25" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1197" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "x-ms-correlation-request-id": [ "5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141132Z:5e8f58b2-6714-4d52-9a30-65f5af9934d0" ], + "Date": [ "Thu, 21 May 2020 14:11:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"HvMwIKaC9H5KSiWnEieqsDad\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 new file mode 100644 index 000000000000..4a7426eb709e --- /dev/null +++ b/src/Blockchain/test/Get-AzBlockchainTransactionNodeApiKey.Tests.ps1 @@ -0,0 +1,19 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Get-AzBlockchainTransactionNodeApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Get-AzBlockchainTransactionNodeApiKey' { + It 'List' { + $tNodeKeys = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + $tNodeKeys.Count | Should -Be 2 + } +} diff --git a/src/Blockchain/test/New-AzBlockchainMember.Recording.json b/src/Blockchain/test/New-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..25981b66dfce --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMember.Recording.json @@ -0,0 +1,660 @@ +{ + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": "{\n \"location\": \"eastus\",\n \"properties\": {\n \"consortium\": \"PowershellConsortiumNamel9b8e0\",\n \"consortiumManagementAccountPassword\": \"strongConsortiumManagementPassword@1\",\n \"password\": \"strongMemberAccountPassword@1\",\n \"protocol\": \"Quorum\"\n },\n \"sku\": {\n \"name\": \"S0\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "291" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "x-ms-correlation-request-id": [ "68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141139Z:68c3b965-ab5f-46be-a3db-79fadd87017a" ], + "Date": [ "Thu, 21 May 2020 14:11:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "811" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11935" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "x-ms-correlation-request-id": [ "e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141210Z:e22a9456-0d46-4e5a-9095-d80ce4a8abc2" ], + "Date": [ "Thu, 21 May 2020 14:12:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11934" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3d5eca19-701b-4652-821b-647e13be2e30" ], + "x-ms-correlation-request-id": [ "3d5eca19-701b-4652-821b-647e13be2e30" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141240Z:3d5eca19-701b-4652-821b-647e13be2e30" ], + "Date": [ "Thu, 21 May 2020 14:12:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11933" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9c735539-5534-4155-9ff1-86b09cb22135" ], + "x-ms-correlation-request-id": [ "9c735539-5534-4155-9ff1-86b09cb22135" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141310Z:9c735539-5534-4155-9ff1-86b09cb22135" ], + "Date": [ "Thu, 21 May 2020 14:13:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11932" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "x-ms-correlation-request-id": [ "d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141341Z:d485db3a-6b11-4af2-8e9b-f0aa21076887" ], + "Date": [ "Thu, 21 May 2020 14:13:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11931" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "x-ms-correlation-request-id": [ "3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141411Z:3208a34a-dff7-4e48-bef8-ced42dbbf86b" ], + "Date": [ "Thu, 21 May 2020 14:14:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11930" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "x-ms-correlation-request-id": [ "9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141441Z:9cdee162-18a3-4ad6-9565-ae8e52748ff8" ], + "Date": [ "Thu, 21 May 2020 14:14:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11929" ], + "x-ms-request-id": [ "7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141512Z:7b12fb1d-293f-4955-b249-376e0025a1b1" ], + "Date": [ "Thu, 21 May 2020 14:15:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11928" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "x-ms-correlation-request-id": [ "623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141543Z:623298a0-73bb-4db8-bf79-4508c7ba9a23" ], + "Date": [ "Thu, 21 May 2020 14:15:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11927" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "dc2f9925-be87-437c-8f62-38625d9fda09" ], + "x-ms-correlation-request-id": [ "dc2f9925-be87-437c-8f62-38625d9fda09" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141613Z:dc2f9925-be87-437c-8f62-38625d9fda09" ], + "Date": [ "Thu, 21 May 2020 14:16:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11926" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b98693a3-14ab-4452-84b4-a218a809869c" ], + "x-ms-correlation-request-id": [ "b98693a3-14ab-4452-84b4-a218a809869c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141643Z:b98693a3-14ab-4452-84b4-a218a809869c" ], + "Date": [ "Thu, 21 May 2020 14:16:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11925" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7c61036b-086e-43c2-b935-5a8399744a39" ], + "x-ms-correlation-request-id": [ "7c61036b-086e-43c2-b935-5a8399744a39" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141714Z:7c61036b-086e-43c2-b935-5a8399744a39" ], + "Date": [ "Thu, 21 May 2020 14:17:13 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11924" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "x-ms-correlation-request-id": [ "773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141744Z:773dfc30-5e01-4ee9-8cf0-57e4a399138b" ], + "Date": [ "Thu, 21 May 2020 14:17:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "815" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11923" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "x-ms-correlation-request-id": [ "762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141814Z:762e6e87-215d-4093-af73-ab3c86ea76bd" ], + "Date": [ "Thu, 21 May 2020 14:18:14 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "857" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11922" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "x-ms-correlation-request-id": [ "048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141845Z:048dfca6-ddee-4ad4-9a80-bf65efda987a" ], + "Date": [ "Thu, 21 May 2020 14:18:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88" ], + "x-ms-client-request-id": [ "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a", "ce161f56-7f4c-43d0-9048-e147888ce29a" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11921" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "fa317527-718f-46f4-a570-7ebcf168a806" ], + "x-ms-correlation-request-id": [ "fa317527-718f-46f4-a570-7ebcf168a806" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141845Z:fa317527-718f-46f4-a570-7ebcf168a806" ], + "Date": [ "Thu, 21 May 2020 14:18:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMember+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "89" ], + "x-ms-client-request-id": [ "ba2a75aa-ecfc-4074-b7c3-e8e25966a2f5" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11920" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "x-ms-correlation-request-id": [ "6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141846Z:6652677b-fdf4-4c5c-ab30-9633b1ef9294" ], + "Date": [ "Thu, 21 May 2020 14:18:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "975" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0x5072f6f17bd07fe049899db605d44ab147289efe\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..3d68022d3b84 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,23 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainMember' { + It 'CreateExpanded' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $bcMemberName = "myblockchain" + $env.rstr2 + New-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup -Consortium ('PowershellConsortiumName' + $env.rstr2) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + $bcMember = Get-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + $bcMember.Name | Should -Be $bcMemberName + } +} diff --git a/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json new file mode 100644 index 000000000000..040710fd60b7 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Recording.json @@ -0,0 +1,187 @@ +{ + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "90" ], + "x-ms-client-request-id": [ "2bf5676f-0dc8-49cc-b7ac-de58fc166446" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1196" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "x-ms-correlation-request-id": [ "d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141847Z:d239ac3a-c409-4e81-b4f6-ebbf852a5892" ], + "Date": [ "Thu, 21 May 2020 14:18:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"8y6u3WirRR8jx1I25vLPYgvY\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1195" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "x-ms-correlation-request-id": [ "74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:74ec9746-4eb1-4419-8560-5f5f9874a389" ], + "Date": [ "Thu, 21 May 2020 14:18:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"zJ-3AMTNbqDn_MixEAkiz1ig\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "92" ], + "x-ms-client-request-id": [ "fe4fd03c-56b7-417e-9de3-7dcfd60b33ce" ], + "CommandName": [ "Get-AzBlockchainMemberApiKey" ], + "FullCommandName": [ "Get-AzBlockchainMemberApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "x-ms-correlation-request-id": [ "0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:0ef77100-9b17-4cb6-b068-d4355f4983af" ], + "Date": [ "Thu, 21 May 2020 14:18:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"zJ-3AMTNbqDn_MixEAkiz1ig\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "93" ], + "x-ms-client-request-id": [ "bc4ae6e6-8ef0-4100-b0aa-aa0a5290c203" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11919" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "x-ms-correlation-request-id": [ "8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141848Z:8cdc57a9-fab3-4298-9a2d-01bc1de13209" ], + "Date": [ "Thu, 21 May 2020 14:18:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "New-AzBlockchainMemberApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "x-ms-correlation-request-id": [ "58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141849Z:58b64ba2-e197-4794-9bff-2cc8aa76f919" ], + "Date": [ "Thu, 21 May 2020 14:18:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"XEZpwH_GIBvuVN6DEUOPrL43\"},{\"keyName\":\"key2\",\"value\":\"axKnh8ZXnqWoJZXJt7vL_Ugc\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 new file mode 100644 index 000000000000..b44a4c7f5cd1 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainMemberApiKey.Tests.ps1 @@ -0,0 +1,32 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainMemberApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainMemberApiKey' { + $keyPair = {} + It 'RegenerateExpanded' { + $keys = New-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + It 'RegenerateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + $bcMember = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $keys = New-AzBlockchainMemberApiKey -InputObject $bcMember -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + #$PSDefaultParameterValues["Disabled"] = $False + } + + BeforeEach { + $keyPair = Get-AzBlockchainMemberApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + } +} diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..20e8c496c9a8 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,582 @@ +{ + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@1\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "97" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "x-ms-correlation-request-id": [ "756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141851Z:756c5284-444f-4a6d-be29-d78ac7e7c1e4" ], + "Date": [ "Thu, 21 May 2020 14:18:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "532" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":null,\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11918" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "x-ms-correlation-request-id": [ "db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141921Z:db0868d7-c66f-4396-b92e-5336aace8dc0" ], + "Date": [ "Thu, 21 May 2020 14:19:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11917" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "x-ms-correlation-request-id": [ "27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T141951Z:27d6b88b-eed5-4d56-9ee4-f0a78634a595" ], + "Date": [ "Thu, 21 May 2020 14:19:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11916" ], + "x-ms-request-id": [ "e479ff92-2050-4565-9ea1-d727aec8c148" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "e479ff92-2050-4565-9ea1-d727aec8c148" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142022Z:e479ff92-2050-4565-9ea1-d727aec8c148" ], + "Date": [ "Thu, 21 May 2020 14:20:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11915" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "x-ms-correlation-request-id": [ "00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142053Z:00c6c218-c2f5-4a81-8b6b-8f0fb74c143a" ], + "Date": [ "Thu, 21 May 2020 14:20:52 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11914" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "x-ms-correlation-request-id": [ "3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142123Z:3713dfe5-9948-46c1-9fe5-81cb33b76ad9" ], + "Date": [ "Thu, 21 May 2020 14:21:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11913" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "x-ms-correlation-request-id": [ "6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142153Z:6b8d5b2b-1730-47f2-88c4-526be9567c7f" ], + "Date": [ "Thu, 21 May 2020 14:21:53 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11912" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "x-ms-correlation-request-id": [ "a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142224Z:a2d8f567-392b-46f2-8443-0b6f1ad2f550" ], + "Date": [ "Thu, 21 May 2020 14:22:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11911" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "x-ms-correlation-request-id": [ "9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142254Z:9450d905-593c-4a1b-94fd-7cc30d359c2b" ], + "Date": [ "Thu, 21 May 2020 14:22:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11910" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b088da3f-0f9e-4202-9ea1-33267271b820" ], + "x-ms-correlation-request-id": [ "b088da3f-0f9e-4202-9ea1-33267271b820" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142324Z:b088da3f-0f9e-4202-9ea1-33267271b820" ], + "Date": [ "Thu, 21 May 2020 14:23:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11909" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "x-ms-correlation-request-id": [ "61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142355Z:61dd1ee3-b623-4d4f-8415-d4077f465f37" ], + "Date": [ "Thu, 21 May 2020 14:23:54 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11908" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3e562c79-c099-4374-852c-e6e527f434ce" ], + "x-ms-correlation-request-id": [ "3e562c79-c099-4374-852c-e6e527f434ce" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142425Z:3e562c79-c099-4374-852c-e6e527f434ce" ], + "Date": [ "Thu, 21 May 2020 14:24:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "588" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11907" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "63de3fde-96f7-4cee-b672-04072f493829" ], + "x-ms-correlation-request-id": [ "63de3fde-96f7-4cee-b672-04072f493829" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142455Z:63de3fde-96f7-4cee-b672-04072f493829" ], + "Date": [ "Thu, 21 May 2020 14:24:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108" ], + "x-ms-client-request-id": [ "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652", "33452d55-5a14-45b8-9750-20d041dd7652" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11906" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "x-ms-correlation-request-id": [ "d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142456Z:d5611dc4-6e7e-405a-9d47-df45428ff2b3" ], + "Date": [ "Thu, 21 May 2020 14:24:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + }, + "New-AzBlockchainTransactionNode+[NoContext]+CreateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "109" ], + "x-ms-client-request-id": [ "99b2a82c-9740-4bdb-a49d-56705ce4c52b" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11905" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "x-ms-correlation-request-id": [ "6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142456Z:6834e24a-229a-4dd6-b981-8f4cd62ea0a1" ], + "Date": [ "Thu, 21 May 2020 14:24:56 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "631" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..81a40ea64320 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainTransactionNode' { + It 'CreateExpanded' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $tNodeName = "myblockchain" + $env.rstr2 + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup -Password $passwd -Location eastus + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $tNodeName + $tNode.Name | Should -Be $tNodeName + } +} diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json new file mode 100644 index 000000000000..42d3c1b5f2fd --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Recording.json @@ -0,0 +1,187 @@ +{ + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "110" ], + "x-ms-client-request-id": [ "459eb7b5-082a-4e14-871e-5bc46f157323" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "x-ms-correlation-request-id": [ "5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142457Z:5bb6a84b-7c81-4b25-8010-5165a0100c08" ], + "Date": [ "Thu, 21 May 2020 14:24:57 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"HvMwIKaC9H5KSiWnEieqsDad\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "x-ms-correlation-request-id": [ "7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142458Z:7a6b875b-7223-49c1-afa5-a795f47f47e8" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"xfSJCMZrToSSC5Qio_gah-gU\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/listApiKeys?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "112" ], + "x-ms-client-request-id": [ "1270aa6a-4071-4ec8-b559-3906fdd13079" ], + "CommandName": [ "Get-AzBlockchainTransactionNodeApiKey" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNodeApiKey_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "x-ms-correlation-request-id": [ "cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142458Z:cdbf0012-6d4f-403b-bcb6-16dafd688108" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"xfSJCMZrToSSC5Qio_gah-gU\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "113" ], + "x-ms-client-request-id": [ "e7ddde34-8932-4e74-be54-c455efa37dd7" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11904" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "x-ms-correlation-request-id": [ "c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142459Z:c4d0b901-27c1-43f9-b689-76f9c4bda9da" ], + "Date": [ "Thu, 21 May 2020 14:24:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "New-AzBlockchainTransactionNodeApiKey+[NoContext]+RegenerateViaIdentityExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n/regenerateApiKeys?api-version=2018-06-01-preview", + "Content": "{\n \"keyName\": \"key1\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "23" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "x-ms-correlation-request-id": [ "50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142500Z:50d31cd1-3454-4d71-bbfb-b661805ca2b0" ], + "Date": [ "Thu, 21 May 2020 14:24:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "118" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"keys\":[{\"keyName\":\"key1\",\"value\":\"JQZJTy2BGZFVjt_YoWQ7mhcP\"},{\"keyName\":\"key2\",\"value\":\"nU1FLtIYsqPXw4DE1V9W9AT4\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 new file mode 100644 index 000000000000..29d2cd0ddc10 --- /dev/null +++ b/src/Blockchain/test/New-AzBlockchainTransactionNodeApiKey.Tests.ps1 @@ -0,0 +1,31 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'New-AzBlockchainTransactionNodeApiKey.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'New-AzBlockchainTransactionNodeApiKey' { + $keyPair = {} + + It 'RegenerateExpanded' { + $keys = New-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + It 'RegenerateViaIdentityExpanded' { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + $keys = New-AzBlockchainTransactionNodeApiKey -InputObject $tnode -KeyName $keyPair[0].KeyName + $keys[0].Value | Should -Not -Be $keyPair[0].Value + } + + BeforeEach { + $keyPair = Get-AzBlockchainTransactionNodeApiKey -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -TransactionNodeName $env.blockchainTransactionNode + } +} diff --git a/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json b/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..2a27b9c1217b --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainMember.Recording.json @@ -0,0 +1,2325 @@ +{ + "Remove-AzBlockchainMember+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": "{\n \"location\": \"eastus\",\n \"properties\": {\n \"consortium\": \"consortiumtxgbo1\",\n \"consortiumManagementAccountPassword\": \"strongConsortiumManagementPassword@1\",\n \"password\": \"strongMemberAccountPassword@1\",\n \"protocol\": \"Quorum\"\n },\n \"sku\": {\n \"name\": \"S0\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "277" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "x-ms-request-id": [ "0ccb65d9-bf02-451e-814a-447681d6981b" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "0ccb65d9-bf02-451e-814a-447681d6981b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142507Z:0ccb65d9-bf02-451e-814a-447681d6981b" ], + "Date": [ "Thu, 21 May 2020 14:25:07 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "797" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11903" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ea92c513-f20b-4644-9a89-8c220f14a296" ], + "x-ms-correlation-request-id": [ "ea92c513-f20b-4644-9a89-8c220f14a296" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142538Z:ea92c513-f20b-4644-9a89-8c220f14a296" ], + "Date": [ "Thu, 21 May 2020 14:25:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11902" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "x-ms-correlation-request-id": [ "a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142609Z:a7db9b8a-ff8e-488f-a3df-42c7e5ddf0a0" ], + "Date": [ "Thu, 21 May 2020 14:26:08 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11901" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "x-ms-correlation-request-id": [ "6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142639Z:6faf5397-9d54-4bef-9ba6-52072d253eaa" ], + "Date": [ "Thu, 21 May 2020 14:26:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11900" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "x-ms-correlation-request-id": [ "aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142709Z:aa8751db-8029-4e5a-803c-dfcef5fdfc85" ], + "Date": [ "Thu, 21 May 2020 14:27:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11899" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "x-ms-correlation-request-id": [ "cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142740Z:cae73b88-bfdc-421c-a1bd-a689b2c3c0b3" ], + "Date": [ "Thu, 21 May 2020 14:27:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11898" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "x-ms-correlation-request-id": [ "4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142810Z:4c1686ce-5257-455f-8a45-ea0032d58c9b" ], + "Date": [ "Thu, 21 May 2020 14:28:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11897" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "x-ms-correlation-request-id": [ "1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142840Z:1dc6d4a0-c00b-4fd8-bac7-f37183a61e3a" ], + "Date": [ "Thu, 21 May 2020 14:28:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11896" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "x-ms-correlation-request-id": [ "9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142911Z:9bb907e6-e5f5-424c-a3a0-febd5d7eedd5" ], + "Date": [ "Thu, 21 May 2020 14:29:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11895" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "x-ms-correlation-request-id": [ "650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T142941Z:650ae6aa-a74a-43e7-9407-a5ec6fb5c8f3" ], + "Date": [ "Thu, 21 May 2020 14:29:41 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11894" ], + "x-ms-request-id": [ "d8e4781b-e909-4322-9333-1068c511c6d9" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "d8e4781b-e909-4322-9333-1068c511c6d9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143011Z:d8e4781b-e909-4322-9333-1068c511c6d9" ], + "Date": [ "Thu, 21 May 2020 14:30:11 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11893" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "78dfc241-dd6b-449f-9563-910fe6148459" ], + "x-ms-correlation-request-id": [ "78dfc241-dd6b-449f-9563-910fe6148459" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143043Z:78dfc241-dd6b-449f-9563-910fe6148459" ], + "Date": [ "Thu, 21 May 2020 14:30:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "801" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11892" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "731c5944-3b07-468d-ba77-e7be32ece74d" ], + "x-ms-correlation-request-id": [ "731c5944-3b07-468d-ba77-e7be32ece74d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143113Z:731c5944-3b07-468d-ba77-e7be32ece74d" ], + "Date": [ "Thu, 21 May 2020 14:31:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "843" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":null,\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Updating\",\"dns\":null,\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11891" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "x-ms-correlation-request-id": [ "c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143143Z:c8d571e4-607e-4d67-9e50-c39c96ade23e" ], + "Date": [ "Thu, 21 May 2020 14:31:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "961" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0xc81133f8de72ff1e9096b53b5eaf6726b1f9a17f\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchaintxgbo1.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "115", "116", "117", "118", "119", "120", "121", "122", "123", "124", "125", "126", "127", "128", "129" ], + "x-ms-client-request-id": [ "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6", "d5e9c576-9f5a-482a-8230-524016ddf9c6" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember", "Az.Blockchain.internal\\New-AzBlockchainMember" ], + "FullCommandName": [ "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded", "New-AzBlockchainMember_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11890" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "x-ms-correlation-request-id": [ "eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143144Z:eff638a2-98db-4084-be2e-ebb6d0cd1e26" ], + "Date": [ "Thu, 21 May 2020 14:31:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "961" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchaintxgbo1\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchaintxgbo1\",\"password\":null,\"consortium\":\"consortiumtxgbo1\",\"consortiumRole\":null,\"consortiumMemberDisplayName\":null,\"consortiumManagementAccountAddress\":\"0xc81133f8de72ff1e9096b53b5eaf6726b1f9a17f\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"laY3xGFLn+wIMdgnHesDekBHWajnWNTdW+ChrxIqY0I=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchaintxgbo1.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchaintxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14999" ], + "x-ms-request-id": [ "3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "x-ms-correlation-request-id": [ "3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143144Z:3d5aa5bc-59fb-4fa8-93dd-408204d66264" ], + "Date": [ "Thu, 21 May 2020 14:31:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11889" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "x-ms-correlation-request-id": [ "a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143215Z:a58f779e-16ac-41d1-a2c7-f9c4df4d3da0" ], + "Date": [ "Thu, 21 May 2020 14:32:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11888" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "x-ms-correlation-request-id": [ "de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143245Z:de73db1c-6d18-47e1-b981-f44c2e8c424e" ], + "Date": [ "Thu, 21 May 2020 14:32:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11887" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "x-ms-correlation-request-id": [ "fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143316Z:fdfebbd1-0bd5-4ce3-bc8a-514db6bdd29d" ], + "Date": [ "Thu, 21 May 2020 14:33:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11886" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "x-ms-correlation-request-id": [ "1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143346Z:1b69c9c5-e0a1-44a4-acfc-03b41f548155" ], + "Date": [ "Thu, 21 May 2020 14:33:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+21": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11885" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "x-ms-correlation-request-id": [ "c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143416Z:c5747e54-88be-48f2-9b29-8d46d00e0d2e" ], + "Date": [ "Thu, 21 May 2020 14:34:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+22": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11884" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "x-ms-correlation-request-id": [ "9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143447Z:9c6c51ff-5c28-4fda-98a2-a4b3ac249c97" ], + "Date": [ "Thu, 21 May 2020 14:34:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+23": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11883" ], + "x-ms-request-id": [ "5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143517Z:5b908193-6f8f-4420-9f2f-da1d07d36065" ], + "Date": [ "Thu, 21 May 2020 14:35:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+24": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11882" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "x-ms-correlation-request-id": [ "2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143547Z:2dfad8ec-67b8-40eb-933f-7a5954c50f97" ], + "Date": [ "Thu, 21 May 2020 14:35:47 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+25": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11881" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "26a98005-d446-4155-9210-115ae5741c5f" ], + "x-ms-correlation-request-id": [ "26a98005-d446-4155-9210-115ae5741c5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143618Z:26a98005-d446-4155-9210-115ae5741c5f" ], + "Date": [ "Thu, 21 May 2020 14:36:17 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+26": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11880" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "x-ms-correlation-request-id": [ "b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143648Z:b593faa7-a535-4d4e-8645-09bfbbff3f03" ], + "Date": [ "Thu, 21 May 2020 14:36:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+27": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11879" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "x-ms-correlation-request-id": [ "f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143718Z:f5676eb5-cc6b-4988-b9c0-1bae878dcfb7" ], + "Date": [ "Thu, 21 May 2020 14:37:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+28": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11878" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "x-ms-correlation-request-id": [ "e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143749Z:e47cc04e-dff6-49a9-ab8d-b9f5730362d0" ], + "Date": [ "Thu, 21 May 2020 14:37:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+29": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11877" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "x-ms-correlation-request-id": [ "6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143819Z:6b9208ca-ddef-4998-82ff-cf65f630270f" ], + "Date": [ "Thu, 21 May 2020 14:38:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+30": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11876" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "x-ms-correlation-request-id": [ "78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143850Z:78375aa1-e7e6-4df3-92f4-3b70e2f734c0" ], + "Date": [ "Thu, 21 May 2020 14:38:49 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+31": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11875" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "x-ms-correlation-request-id": [ "bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143920Z:bf4394db-d8a8-4968-91ed-00ec68d54acf" ], + "Date": [ "Thu, 21 May 2020 14:39:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+32": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11874" ], + "x-ms-request-id": [ "a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T143950Z:a0e598dd-0a28-45be-9cba-418cb94bc510" ], + "Date": [ "Thu, 21 May 2020 14:39:50 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+33": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11873" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "x-ms-correlation-request-id": [ "a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144021Z:a7f2bd74-6bba-4b72-882e-088d9d79d2a2" ], + "Date": [ "Thu, 21 May 2020 14:40:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+34": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11872" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "x-ms-correlation-request-id": [ "9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144052Z:9af8a5c8-a94a-4c18-962f-4dc66864c279" ], + "Date": [ "Thu, 21 May 2020 14:40:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+35": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11871" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "x-ms-correlation-request-id": [ "dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144125Z:dd1f9ec2-7034-47a9-ae8a-df35193c2f08" ], + "Date": [ "Thu, 21 May 2020 14:41:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+36": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11870" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "x-ms-correlation-request-id": [ "8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144155Z:8f8ead22-25ec-41eb-92de-b8d440096bb8" ], + "Date": [ "Thu, 21 May 2020 14:41:55 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:31:44.8379303Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+37": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11869" ], + "x-ms-request-id": [ "9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "x-ms-correlation-request-id": [ "9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144226Z:9b622907-26b8-448d-bad9-9e5d799d5ceb" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview+38": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/d7e14393-9e2f-4a2e-9f4e-642cc585ac1c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "130", "131", "132", "133", "134", "135", "136", "137", "138", "139", "140", "141", "142", "143", "144", "145", "146", "147", "148", "149", "150", "151", "152" ], + "x-ms-client-request-id": [ "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f", "21c4fee7-e039-4e74-bd7b-bbd4f18fa97f" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete", "Remove-AzBlockchainMember_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11868" ], + "x-ms-request-id": [ "3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "x-ms-correlation-request-id": [ "3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144226Z:3337bf92-6b84-45f0-b1f8-0cc74f0124ab" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+39": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "153" ], + "x-ms-client-request-id": [ "8f097578-4f12-4ddf-823f-b2354299a364" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11867" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4a452765-b385-48a8-84a4-561bb339e992" ], + "x-ms-correlation-request-id": [ "4a452765-b385-48a8-84a4-561bb339e992" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144227Z:4a452765-b385-48a8-84a4-561bb339e992" ], + "Date": [ "Thu, 21 May 2020 14:42:26 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "2848" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainl9b8e0\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "154" ], + "x-ms-client-request-id": [ "6b32d730-16a5-4682-a3c6-e9a0e5b4d22f" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11866" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "x-ms-correlation-request-id": [ "48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144227Z:48d7dc57-b49f-4d15-bdb4-4df704c9dc34" ], + "Date": [ "Thu, 21 May 2020 14:42:27 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "980" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainlcnk5s\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainlcnk5s\",\"password\":null,\"consortium\":\"consortiumlcnk5s\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainlcnk5s\",\"consortiumManagementAccountAddress\":\"0x3e540354d116ba43930f178db126cbdaec727607\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"Ffib21RlP7QE3q56k/uL4ps/x7/jnqpfhavGWgvwLls=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainlcnk5s.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainlcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14998" ], + "x-ms-request-id": [ "80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "x-ms-correlation-request-id": [ "80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144228Z:80a102ae-ad41-4b58-896f-1e4271caf78d" ], + "Date": [ "Thu, 21 May 2020 14:42:28 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11865" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "x-ms-correlation-request-id": [ "8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144258Z:8a42406a-93bb-4beb-ae88-4f31bc4218aa" ], + "Date": [ "Thu, 21 May 2020 14:42:58 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11864" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "x-ms-correlation-request-id": [ "6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144329Z:6f034804-e4c3-40a2-bcdb-3dc400ce8bb5" ], + "Date": [ "Thu, 21 May 2020 14:43:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11863" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "x-ms-correlation-request-id": [ "b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144359Z:b1b0833e-5aed-4892-a344-1a72aa152f71" ], + "Date": [ "Thu, 21 May 2020 14:43:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11862" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "x-ms-correlation-request-id": [ "bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144429Z:bc1fdf27-dbee-472d-939a-8a9db91c0e45" ], + "Date": [ "Thu, 21 May 2020 14:44:29 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11861" ], + "x-ms-request-id": [ "6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144500Z:6ec59a35-6540-462e-9e0b-87c0775e4804" ], + "Date": [ "Thu, 21 May 2020 14:44:59 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11860" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "073718e0-15f5-4325-ac13-e080c45df24e" ], + "x-ms-correlation-request-id": [ "073718e0-15f5-4325-ac13-e080c45df24e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144531Z:073718e0-15f5-4325-ac13-e080c45df24e" ], + "Date": [ "Thu, 21 May 2020 14:45:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11859" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "x-ms-correlation-request-id": [ "15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144601Z:15a3423b-3ba8-49ff-9b2c-02fadefeee05" ], + "Date": [ "Thu, 21 May 2020 14:46:01 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11858" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "693fb903-004c-4313-a0d0-b540137769f4" ], + "x-ms-correlation-request-id": [ "693fb903-004c-4313-a0d0-b540137769f4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144632Z:693fb903-004c-4313-a0d0-b540137769f4" ], + "Date": [ "Thu, 21 May 2020 14:46:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "x-ms-correlation-request-id": [ "cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144702Z:cf1a232d-8d8b-4753-8cfd-143510e0a447" ], + "Date": [ "Thu, 21 May 2020 14:47:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "51af4343-cb4f-40b1-90f2-086547d71a67" ], + "x-ms-correlation-request-id": [ "51af4343-cb4f-40b1-90f2-086547d71a67" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144732Z:51af4343-cb4f-40b1-90f2-086547d71a67" ], + "Date": [ "Thu, 21 May 2020 14:47:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "x-ms-correlation-request-id": [ "13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144803Z:13fd29c0-8890-45f6-bf9a-5168d5c76641" ], + "Date": [ "Thu, 21 May 2020 14:48:02 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "954bf57b-e297-4984-8222-a8015728b791" ], + "x-ms-correlation-request-id": [ "954bf57b-e297-4984-8222-a8015728b791" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144833Z:954bf57b-e297-4984-8222-a8015728b791" ], + "Date": [ "Thu, 21 May 2020 14:48:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7c027b93-5608-4fae-af08-391edea1add4" ], + "x-ms-correlation-request-id": [ "7c027b93-5608-4fae-af08-391edea1add4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144904Z:7c027b93-5608-4fae-af08-391edea1add4" ], + "Date": [ "Thu, 21 May 2020 14:49:03 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "x-ms-correlation-request-id": [ "c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T144934Z:c86e8f9c-28d1-4d6f-b1e3-5145e9af0604" ], + "Date": [ "Thu, 21 May 2020 14:49:33 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11858" ], + "x-ms-request-id": [ "5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145004Z:5465ec1e-cdb9-43bc-abac-21cddbc88266" ], + "Date": [ "Thu, 21 May 2020 14:50:04 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "91" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteBlockchainMember\",\"startTime\":\"2020-05-21T14:42:28.1716603Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170", "171" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "x-ms-request-id": [ "f9d30523-054e-4354-b556-d527df6aca5f" ], + "x-ms-correlation-request-id": [ "f9d30523-054e-4354-b556-d527df6aca5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145035Z:f9d30523-054e-4354-b556-d527df6aca5f" ], + "Date": [ "Thu, 21 May 2020 14:50:35 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/17e666ae-cb2b-4b48-9836-dc381fa7800c?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "155", "156", "157", "158", "159", "160", "161", "162", "163", "164", "165", "166", "167", "168", "169", "170", "171", "172" ], + "x-ms-client-request-id": [ "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1", "1c37c1c4-b8ab-4398-9fe0-084a65c6cde1" ], + "CommandName": [ "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember", "Remove-AzBlockchainMember" ], + "FullCommandName": [ "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity", "Remove-AzBlockchainMember_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "x-ms-request-id": [ "3c797104-756e-43f6-982f-fce81eea4a93" ], + "x-ms-correlation-request-id": [ "3c797104-756e-43f6-982f-fce81eea4a93" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145036Z:3c797104-756e-43f6-982f-fce81eea4a93" ], + "Date": [ "Thu, 21 May 2020 14:50:36 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainMember+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "173" ], + "x-ms-client-request-id": [ "36f022be-1d17-4805-80c5-0d927793c529" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "66d8b73d-53af-4632-8aae-4d4420697b66" ], + "x-ms-correlation-request-id": [ "66d8b73d-53af-4632-8aae-4d4420697b66" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145036Z:66d8b73d-53af-4632-8aae-4d4420697b66" ], + "Date": [ "Thu, 21 May 2020 14:50:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1907" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"consortium\":\"PowershellConsortiumNamel9b8e0\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainl9b8e0\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"2o79neyXjvO9R0NoQ3WTJJJJKUC29eapgWql428URgY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainl9b8e0\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..e17142de3dda --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzBlockchainMember' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + It 'Delete' { + $bcMemberName = "myblockchain" + $env.rstr3 + New-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup -Consortium ("consortium" + $env.rstr3) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + Remove-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + $bcMemberList = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMemberList.Name | Should -Not -Contain $bcMemberName + } + + It 'DeleteViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $bcMemberName = "myblockchain" + $env.rstr4 + $member = Get-AzBlockchainMember -Name $bcMemberName -ResourceGroupName $env.resourceGroup + Remove-AzBlockchainMember -InputObject $member + $bcMemberList = Get-AzBlockchainMember -ResourceGroupName $env.resourceGroup + $bcMemberList.Name | Should -Not -Contain $bcMemberName + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..985f39bf4b47 --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,1406 @@ +{ + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$PUT+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PUT", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@1\"\n },\n \"location\": \"eastus\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "97" ] + } + }, + "Response": { + "StatusCode": 201, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "x-ms-correlation-request-id": [ "f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145039Z:f0ad109e-7869-4b1c-963f-cc2250e2e8b8" ], + "Date": [ "Thu, 21 May 2020 14:50:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "535" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":null,\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "x-ms-correlation-request-id": [ "5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145109Z:5b48db39-1a36-4aa6-a685-477ba3dee5b9" ], + "Date": [ "Thu, 21 May 2020 14:51:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "270664a8-abce-410b-a5b3-cb23464a2162" ], + "x-ms-correlation-request-id": [ "270664a8-abce-410b-a5b3-cb23464a2162" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145140Z:270664a8-abce-410b-a5b3-cb23464a2162" ], + "Date": [ "Thu, 21 May 2020 14:51:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "x-ms-correlation-request-id": [ "8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145210Z:8cf01cf7-d613-47aa-9a98-2e1334620c7c" ], + "Date": [ "Thu, 21 May 2020 14:52:09 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "x-ms-correlation-request-id": [ "099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145240Z:099b7503-ea21-41a0-85f2-25ce1fa63cc3" ], + "Date": [ "Thu, 21 May 2020 14:52:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "x-ms-correlation-request-id": [ "50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145311Z:50232911-ed83-4682-b3d4-8c95a5fa21dd" ], + "Date": [ "Thu, 21 May 2020 14:53:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "x-ms-correlation-request-id": [ "38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145341Z:38aea4de-8d7e-43f4-a60c-5320af151b27" ], + "Date": [ "Thu, 21 May 2020 14:53:40 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "x-ms-correlation-request-id": [ "9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145411Z:9a92685a-a315-4b31-b9c0-d9e69a364bfb" ], + "Date": [ "Thu, 21 May 2020 14:54:10 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+9": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "x-ms-correlation-request-id": [ "8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145442Z:8dd8dc42-53c1-4d52-b65f-133f4ff798e9" ], + "Date": [ "Thu, 21 May 2020 14:54:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+10": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11857" ], + "x-ms-request-id": [ "854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145512Z:854a84d4-3516-4b56-9f57-53e5f2b59db4" ], + "Date": [ "Thu, 21 May 2020 14:55:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+11": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "x-ms-correlation-request-id": [ "695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145543Z:695674f2-8d63-4f37-b57b-d7d7c34efc60" ], + "Date": [ "Thu, 21 May 2020 14:55:42 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+12": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "747500b1-38b0-449a-be0d-c11a00da56f4" ], + "x-ms-correlation-request-id": [ "747500b1-38b0-449a-be0d-c11a00da56f4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145613Z:747500b1-38b0-449a-be0d-c11a00da56f4" ], + "Date": [ "Thu, 21 May 2020 14:56:12 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "592" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Updating\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":null,\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+13": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "x-ms-correlation-request-id": [ "4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:4ec8dc12-cc91-4b98-935b-ebd0cca16cc3" ], + "Date": [ "Thu, 21 May 2020 14:56:43 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"/+UKrZlYMCEUTkCn8bHOZvFyP/IXsqen6yu+50VYsx0=\",\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+14": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "174", "175", "176", "177", "178", "179", "180", "181", "182", "183", "184", "185", "186", "187" ], + "x-ms-client-request-id": [ "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89", "4d3ad175-a88d-4d17-b0b5-44eef2ed9a89" ], + "CommandName": [ "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode", "Az.Blockchain.internal\\New-AzBlockchainTransactionNode" ], + "FullCommandName": [ "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded", "New-AzBlockchainTransactionNode_CreateExpanded" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "x-ms-correlation-request-id": [ "e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:e1d3fab2-3593-4f35-8ef3-620abf34cc23" ], + "Date": [ "Thu, 21 May 2020 14:56:44 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodetxgbo1\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodetxgbo1-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"/+UKrZlYMCEUTkCn8bHOZvFyP/IXsqen6yu+50VYsx0=\",\"userName\":\"tranctionnodetxgbo1\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview+15": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodetxgbo1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14997" ], + "x-ms-request-id": [ "53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "x-ms-correlation-request-id": [ "53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145644Z:53d1dcba-eb3a-4813-af7e-b646b853644d" ], + "Date": [ "Thu, 21 May 2020 14:56:44 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+16": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "x-ms-correlation-request-id": [ "f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145715Z:f88fa41d-d7f1-4de0-b5b9-8984324e1a56" ], + "Date": [ "Thu, 21 May 2020 14:57:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+17": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "x-ms-correlation-request-id": [ "95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145745Z:95f065b1-a642-4cdb-809e-06ddbf01fa48" ], + "Date": [ "Thu, 21 May 2020 14:57:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+18": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "31fd1349-7560-49dc-ba30-620089c61fa5" ], + "x-ms-correlation-request-id": [ "31fd1349-7560-49dc-ba30-620089c61fa5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145815Z:31fd1349-7560-49dc-ba30-620089c61fa5" ], + "Date": [ "Thu, 21 May 2020 14:58:15 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+19": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "x-ms-correlation-request-id": [ "0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145846Z:0bb76730-ea09-4ef6-a6b6-e105e19981be" ], + "Date": [ "Thu, 21 May 2020 14:58:45 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+20": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "x-ms-correlation-request-id": [ "c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145916Z:c118d5a1-a4e6-416e-a51b-87eb64e11774" ], + "Date": [ "Thu, 21 May 2020 14:59:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+21": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "x-ms-correlation-request-id": [ "6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T145946Z:6bcb38be-5a8e-4382-80e7-a9a487426d39" ], + "Date": [ "Thu, 21 May 2020 14:59:46 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+22": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11856" ], + "x-ms-request-id": [ "504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-correlation-request-id": [ "504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150017Z:504c9421-4db2-46ff-a6ae-b1588aae430e" ], + "Date": [ "Thu, 21 May 2020 15:00:16 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+23": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11855" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "x-ms-correlation-request-id": [ "e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150048Z:e7acbd7d-bec0-49cb-916e-cb43a031fff4" ], + "Date": [ "Thu, 21 May 2020 15:00:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+24": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11854" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "x-ms-correlation-request-id": [ "817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150118Z:817ae7d1-b454-47af-92a8-7dacaa6db6cd" ], + "Date": [ "Thu, 21 May 2020 15:01:18 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+25": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11853" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "x-ms-correlation-request-id": [ "7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150148Z:7d6d5f98-2075-459a-b37c-84abe0d12e15" ], + "Date": [ "Thu, 21 May 2020 15:01:48 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T14:56:44.6869205Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+26": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11852" ], + "x-ms-request-id": [ "d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "x-ms-correlation-request-id": [ "d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150219Z:d0bc8f01-17d3-4bbf-858d-ed910724df6c" ], + "Date": [ "Thu, 21 May 2020 15:02:18 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview+27": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/22958841-27d3-4c96-a53c-903b34c2f7e1?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "188", "189", "190", "191", "192", "193", "194", "195", "196", "197", "198", "199", "200" ], + "x-ms-client-request-id": [ "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9", "50a38fc3-a437-4119-889b-ad674b47e7e9" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete", "Remove-AzBlockchainTransactionNode_Delete" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11851" ], + "x-ms-request-id": [ "5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "x-ms-correlation-request-id": [ "5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150219Z:5a4faa9b-3824-4cef-9825-6d844dc83070" ], + "Date": [ "Thu, 21 May 2020 15:02:18 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+Delete+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+28": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "201" ], + "x-ms-client-request-id": [ "6b3447df-4ef5-4ee9-a4a2-aaf76f3efee6" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11850" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "x-ms-correlation-request-id": [ "c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:c3f28020-a219-4e0b-b10b-ffded6f0f419" ], + "Date": [ "Thu, 21 May 2020 15:02:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1915" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}]}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "202" ], + "x-ms-client-request-id": [ "02675717-aa94-4751-9d74-deda426fddbf" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11849" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "x-ms-correlation-request-id": [ "2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:2e164722-40e9-415a-a4a2-c7b6bc545f4f" ], + "Date": [ "Thu, 21 May 2020 15:02:19 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodelcnk5s\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodelcnk5s-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"eyf016vn1xxiYkmULb2tp7iuF4CTDOyotiVUM05RPGE=\",\"userName\":\"tranctionnodelcnk5s\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s\"}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$DELETE+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "DELETE", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodelcnk5s?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-deletes": [ "14996" ], + "x-ms-request-id": [ "3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "x-ms-correlation-request-id": [ "3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150220Z:3763a631-18c5-4513-8d9c-51e5b40d89db" ], + "Date": [ "Thu, 21 May 2020 15:02:20 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ], + "Content-Length": [ "0" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11848" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "7f6a3381-6213-4cc7-8531-018170b3e592" ], + "x-ms-correlation-request-id": [ "7f6a3381-6213-4cc7-8531-018170b3e592" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150251Z:7f6a3381-6213-4cc7-8531-018170b3e592" ], + "Date": [ "Thu, 21 May 2020 15:02:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11847" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "x-ms-correlation-request-id": [ "4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150321Z:4ff4454b-7fb1-4ec0-ac47-d32d0d4e148f" ], + "Date": [ "Thu, 21 May 2020 15:03:21 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+5": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 202, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "Location": [ "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11846" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "35d286b0-cd43-4445-a707-c0a207380552" ], + "x-ms-correlation-request-id": [ "35d286b0-cd43-4445-a707-c0a207380552" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150352Z:35d286b0-cd43-4445-a707-c0a207380552" ], + "Date": [ "Thu, 21 May 2020 15:03:51 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "90" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"name\":\"DeleteTransactionNode\",\"startTime\":\"2020-05-21T15:02:20.7535142Z\",\"endTime\":null}" + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+6": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206", "207" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11845" ], + "x-ms-request-id": [ "e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "x-ms-correlation-request-id": [ "e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150422Z:e28a5690-3c00-40fb-b5a7-ec7d8e56f876" ], + "Date": [ "Thu, 21 May 2020 15:04:21 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview+7": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/blockchainMemberOperationResults/2e709af0-70b7-46a2-9964-b76514b5724f?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "203", "204", "205", "206", "207", "208" ], + "x-ms-client-request-id": [ "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515", "243049fb-c2ca-42bd-94e5-da8430fdd515" ], + "CommandName": [ "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode", "Remove-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity", "Remove-AzBlockchainTransactionNode_DeleteViaIdentity" ], + "ParameterSetName": [ "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets", "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview", "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 204, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11844" ], + "x-ms-request-id": [ "f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "x-ms-correlation-request-id": [ "f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150423Z:f58bc226-8a2b-4dde-8319-5ca26c2bc03e" ], + "Date": [ "Thu, 21 May 2020 15:04:22 GMT" ] + }, + "ContentHeaders": { + "Expires": [ "-1" ] + }, + "Content": null + } + }, + "Remove-AzBlockchainTransactionNode+[NoContext]+DeleteViaIdentity+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview+8": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "209" ], + "x-ms-client-request-id": [ "bdfeadf6-a86c-4eaa-ad19-0052e0bf5625" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_List" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11843" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "x-ms-correlation-request-id": [ "a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150423Z:a5d14ce2-20a5-447c-8852-930efffcf89d" ], + "Date": [ "Thu, 21 May 2020 15:04:22 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1279" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"value\":[{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"},{\"location\":\"eastus\",\"name\":\"myblockchainl9b8e0\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainl9b8e0-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"IZGyC2NZwSPbsU9+PyacTDpKrkQy/PtXcHWAwPFnGQQ=\",\"userName\":\"myblockchainl9b8e0\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/myblockchainl9b8e0\"}]}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..c006b5a5bd24 --- /dev/null +++ b/src/Blockchain/test/Remove-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,33 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Remove-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Remove-AzBlockchainTransactionNode' { + It 'Delete' { + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $tNodeName = "tranctionnode" + $env.rstr3 + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd + Remove-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup + $tNodeList = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodeList.Name | Should -Not -Contain $tNodeName + } + + It 'DeleteViaIdentity' { + #$PSDefaultParameterValues["Disabled"] = $True + $tNodeName = "tranctionnode" + $env.rstr4 + $node = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $tNodeName -ResourceGroupName $env.resourceGroup + Remove-AzBlockchainTransactionNode -InputObject $node + $tNodeList = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup + $tNodeList.Name | Should -Not -Contain $tNodeName + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json new file mode 100644 index 000000000000..edd6f27a7256 --- /dev/null +++ b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Recording.json @@ -0,0 +1,70 @@ +{ + "Test-AzBlockchainLocationNameAvailability+[NoContext]+CheckExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview", + "Content": "{\n \"name\": \"123\",\n \"type\": \"Microsoft.Blockchain/blockchainMembers\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "71" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11842" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "x-ms-correlation-request-id": [ "3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150424Z:3dc15267-49ab-4b38-b7d0-ff8e4d3f8664" ], + "Date": [ "Thu, 21 May 2020 15:04:23 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "234" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nameAvailable\":false,\"message\":\"The blockchain member name is invalid. It can contain only lowercase letters and numbers. The first character must be a letter. The value must be between 2 and 20 characters long.\",\"reason\":\"Invalid\"}" + } + }, + "Test-AzBlockchainLocationNameAvailability+[NoContext]+CheckExpanded+$POST+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "POST", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/providers/Microsoft.Blockchain/locations/eastus/checkNameAvailability?api-version=2018-06-01-preview", + "Content": "{\n \"name\": \"lucasblockchain01\",\n \"type\": \"Microsoft.Blockchain/blockchainMembers\"\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "85" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11841" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "x-ms-correlation-request-id": [ "b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150425Z:b2dd1e79-7f1f-4dc3-a12d-a86ce376cf5f" ], + "Date": [ "Thu, 21 May 2020 15:04:24 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "61" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"nameAvailable\":true,\"message\":null,\"reason\":\"NotSpecified\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 new file mode 100644 index 000000000000..31b9751362b0 --- /dev/null +++ b/src/Blockchain/test/Test-AzBlockchainLocationNameAvailability.Tests.ps1 @@ -0,0 +1,22 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Test-AzBlockchainLocationNameAvailability.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Test-AzBlockchainLocationNameAvailability' { + It 'CheckExpanded' { + $result = Test-AzBlockchainLocationNameAvailability -Location eastus -Name '123' -Type Microsoft.Blockchain/blockchainMembers + $result.NameAvailable| Should -Be $False + + $result = Test-AzBlockchainLocationNameAvailability -Location eastus -Name 'lucasblockchain01' -Type Microsoft.Blockchain/blockchainMembers + $result.NameAvailable| Should -Be $True + } +} diff --git a/src/Blockchain/test/Update-AzBlockchainMember.Recording.json b/src/Blockchain/test/Update-AzBlockchainMember.Recording.json new file mode 100644 index 000000000000..4b9d8d5a48c6 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainMember.Recording.json @@ -0,0 +1,255 @@ +{ + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@2\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1194" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "19b78263-c409-40be-90d9-2e536d7b07f5" ], + "x-ms-correlation-request-id": [ "19b78263-c409-40be-90d9-2e536d7b07f5" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150426Z:19b78263-c409-40be-90d9-2e536d7b07f5" ], + "Date": [ "Thu, 21 May 2020 15:04:25 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "773" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"tags\": {\n \"update\": \"password\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "44" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1193" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "x-ms-correlation-request-id": [ "75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:75e5ee21-e5dd-42f2-a3a3-5e7e486f15a2" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "790" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "214" ], + "x-ms-client-request-id": [ "2d7d13da-88b4-4d77-b857-0e68a85ae118" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11840" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "x-ms-correlation-request-id": [ "17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:17eb154c-3eb1-4b26-ab2c-7491c396049e" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "997" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "215" ], + "x-ms-client-request-id": [ "608e5d36-b6b4-42ea-9973-83499f6102b6" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11839" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "x-ms-correlation-request-id": [ "9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150431Z:9870e5bc-80d2-4f1e-8414-40ea03005ded" ], + "Date": [ "Thu, 21 May 2020 15:04:31 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "997" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"update\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@3\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1192" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "316f8a62-4910-4770-988d-6a83759141cc" ], + "x-ms-correlation-request-id": [ "316f8a62-4910-4770-988d-6a83759141cc" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150432Z:316f8a62-4910-4770-988d-6a83759141cc" ], + "Date": [ "Thu, 21 May 2020 15:04:32 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "773" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":null,\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+3": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"tags\": {\n \"againupdate\": \"password\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "49" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1191" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "x-ms-correlation-request-id": [ "3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150436Z:3598fc9c-61bd-4fb4-86e6-6b980575742c" ], + "Date": [ "Thu, 21 May 2020 15:04:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "795" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":null,\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":null,\"consortiumManagementAccountPassword\":null,\"firewallRules\":null,\"rootContractAddress\":null,\"publicKey\":null,\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"againupdate\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + }, + "Update-AzBlockchainMember+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview+4": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "218" ], + "x-ms-client-request-id": [ "ab6c51ba-e3eb-4228-91bc-f23e20f6f02a" ], + "CommandName": [ "Get-AzBlockchainMember" ], + "FullCommandName": [ "Get-AzBlockchainMember_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11838" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "x-ms-correlation-request-id": [ "d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150436Z:d212623d-1fca-487d-a7f5-de9b160d63fb" ], + "Date": [ "Thu, 21 May 2020 15:04:36 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "1002" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"myblockchainhv0x8n\",\"kind\":\"Quorum\",\"properties\":{\"validatorNodesSku\":{\"capacity\":2},\"userName\":\"myblockchainhv0x8n\",\"password\":null,\"consortium\":\"consortiumhv0x8n\",\"consortiumRole\":\"ADMIN\",\"consortiumMemberDisplayName\":\"myblockchainhv0x8n\",\"consortiumManagementAccountAddress\":\"0x69e234a9e922d6533ffe5d82ad841e717cc9a241\",\"consortiumManagementAccountPassword\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}],\"rootContractAddress\":\"0xb255f55e8d600f09ebc1035dd2118acec1018912\",\"publicKey\":\"yQ5nsc8YtNUKuMHjb7Q+XHQiO7PY6DJVVm5E0g3D/lY=\",\"provisioningState\":\"Succeeded\",\"dns\":\"myblockchainhv0x8n.blockchain.azure.com\",\"protocol\":\"Quorum\"},\"type\":\"Microsoft.Blockchain/blockchainMembers\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n\",\"tags\":{\"againupdate\":\"password\"},\"sku\":{\"name\":\"S0\",\"tier\":\"Standard\"}}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 b/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 new file mode 100644 index 000000000000..76a3a1e56b83 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainMember.Tests.ps1 @@ -0,0 +1,34 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzBlockchainMember.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzBlockchainMember' { + $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force + $passwd3 = 'strongMemberAccountPassword@3' | ConvertTo-SecureString -AsPlainText -Force + It 'UpdateExpanded' { + $tag = @{'update'='password'} + Update-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Password $passwd2 + Update-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Tag $tag + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $member.Tag.ContainsKey('update') | Should -Be $True + } + + It 'UpdateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + $tag = @{'againupdate'='password'} + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + Update-AzBlockchainMember -InputObject $member -Password $passwd3 + Update-AzBlockchainMember -InputObject $member -Tag $tag + $member = Get-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup + $member.Tag.ContainsKey('againupdate') | Should -Be $True + } +} diff --git a/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json new file mode 100644 index 000000000000..816b6ce39ef4 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Recording.json @@ -0,0 +1,109 @@ +{ + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@2\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1190" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "289159d5-3e3a-4726-8377-5ca917d924fa" ], + "x-ms-correlation-request-id": [ "289159d5-3e3a-4726-8377-5ca917d924fa" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150437Z:289159d5-3e3a-4726-8377-5ca917d924fa" ], + "Date": [ "Thu, 21 May 2020 15:04:37 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "554" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":null},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateViaIdentityExpanded+$GET+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+1": { + "Request": { + "Method": "GET", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": null, + "Headers": { + "x-ms-unique-id": [ "220" ], + "x-ms-client-request-id": [ "4cf2c0fe-9735-43c4-aeaf-9a70f6eb580b" ], + "CommandName": [ "Get-AzBlockchainTransactionNode" ], + "FullCommandName": [ "Get-AzBlockchainTransactionNode_Get" ], + "ParameterSetName": [ "__AllParameterSets" ], + "User-Agent": [ "AzurePowershell/Az4.0.0-preview" ], + "Authorization": [ "[Filtered]" ] + }, + "ContentHeaders": { + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-reads": [ "11837" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "x-ms-correlation-request-id": [ "f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150438Z:f40ae70c-f60a-42f2-91eb-9f0b7ef2873d" ], + "Date": [ "Thu, 21 May 2020 15:04:38 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "635" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":[{\"ruleName\":\"AllowAll\",\"startIpAddress\":\"0.0.0.0\",\"endIpAddress\":\"255.255.255.255\"}]},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + }, + "Update-AzBlockchainTransactionNode+[NoContext]+UpdateViaIdentityExpanded+$PATCH+https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview+2": { + "Request": { + "Method": "PATCH", + "RequestUri": "https://management.azure.com/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n?api-version=2018-06-01-preview", + "Content": "{\n \"properties\": {\n \"password\": \"strongMemberAccountPassword@3\"\n }\n}", + "Headers": { + }, + "ContentHeaders": { + "Content-Type": [ "application/json" ], + "Content-Length": [ "73" ] + } + }, + "Response": { + "StatusCode": 200, + "Headers": { + "Cache-Control": [ "no-cache" ], + "Pragma": [ "no-cache" ], + "x-ms-ratelimit-remaining-subscription-writes": [ "1189" ], + "X-Content-Type-Options": [ "nosniff" ], + "Strict-Transport-Security": [ "max-age=31536000; includeSubDomains" ], + "Server": [ "Kestrel" ], + "x-ms-request-id": [ "ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "x-ms-correlation-request-id": [ "ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "x-ms-routing-request-id": [ "SOUTHEASTASIA:20200521T150439Z:ea4cef16-e391-4298-9d3f-b5e1c806c164" ], + "Date": [ "Thu, 21 May 2020 15:04:39 GMT" ] + }, + "ContentHeaders": { + "Content-Length": [ "554" ], + "Content-Type": [ "application/json; charset=utf-8" ], + "Expires": [ "-1" ] + }, + "Content": "{\"location\":\"eastus\",\"name\":\"tranctionnodehv0x8n\",\"properties\":{\"provisioningState\":\"Succeeded\",\"dns\":\"tranctionnodehv0x8n-myblockchainhv0x8n.blockchain.azure.com\",\"publicKey\":\"hsQCJDg8PXmvkT8j4vY7x6whlZ398OaIQju++yMnoUI=\",\"userName\":\"tranctionnodehv0x8n\",\"password\":null,\"firewallRules\":null},\"type\":\"Microsoft.Blockchain/blockchainMembers/transactionNodes\",\"id\":\"/subscriptions/9e223dbe-3399-4e19-88eb-0975f02ac87f/resourceGroups/testgrouphv0x8n/providers/Microsoft.Blockchain/blockchainMembers/myblockchainhv0x8n/transactionNodes/tranctionnodehv0x8n\"}" + } + } +} \ No newline at end of file diff --git a/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 new file mode 100644 index 000000000000..624168718fa9 --- /dev/null +++ b/src/Blockchain/test/Update-AzBlockchainTransactionNode.Tests.ps1 @@ -0,0 +1,30 @@ +$loadEnvPath = Join-Path $PSScriptRoot 'loadEnv.ps1' +if (-Not (Test-Path -Path $loadEnvPath)) { + $loadEnvPath = Join-Path $PSScriptRoot '..\loadEnv.ps1' +} +. ($loadEnvPath) +$TestRecordingFile = Join-Path $PSScriptRoot 'Update-AzBlockchainTransactionNode.Recording.json' +$currentPath = $PSScriptRoot +while(-not $mockingPath) { + $mockingPath = Get-ChildItem -Path $currentPath -Recurse -Include 'HttpPipelineMocking.ps1' -File + $currentPath = Split-Path -Path $currentPath -Parent +} +. ($mockingPath | Select-Object -First 1).FullName + +Describe 'Update-AzBlockchainTransactionNode' { + $passwd2 = 'strongMemberAccountPassword@2' | ConvertTo-SecureString -AsPlainText -Force + $passwd3 = 'strongMemberAccountPassword@3' | ConvertTo-SecureString -AsPlainText -Force + It 'UpdateExpanded' { + { Update-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $env.blockchainTransactionNode -ResourceGroupName $env.resourceGroup -Password $passwd2 } | Should -Not -Throw + + } + + It 'UpdateViaIdentityExpanded' { + #$PSDefaultParameterValues["Disabled"] = $True + { + $tNode = Get-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -ResourceGroupName $env.resourceGroup -Name $env.blockchainTransactionNode + Update-AzBlockchainTransactionNode -InputObject $tNode -Password $passwd3 + } | Should -Not -Throw + #$PSDefaultParameterValues["Disabled"] = $False + } +} diff --git a/src/Blockchain/test/env.json b/src/Blockchain/test/env.json new file mode 100644 index 000000000000..51c810cb0698 --- /dev/null +++ b/src/Blockchain/test/env.json @@ -0,0 +1,17 @@ +{ + "resourceGroup": "testgrouphv0x8n", + "passwd": { + "Length": 29 + }, + "blockchainMember": "myblockchainhv0x8n", + "rstr1": "hv0x8n", + "blockchainTransactionNode": "tranctionnodehv0x8n", + "csPasswd": { + "Length": 36 + }, + "rstr4": "lcnk5s", + "rstr3": "txgbo1", + "SubscriptionId": "9e223dbe-3399-4e19-88eb-0975f02ac87f", + "Tenant": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "rstr2": "l9b8e0" +} diff --git a/src/Blockchain/test/loadEnv.ps1 b/src/Blockchain/test/loadEnv.ps1 new file mode 100644 index 000000000000..c4ebf2e8310c --- /dev/null +++ b/src/Blockchain/test/loadEnv.ps1 @@ -0,0 +1,28 @@ +# ---------------------------------------------------------------------------------- +# +# Copyright Microsoft Corporation +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ---------------------------------------------------------------------------------- +$envFile = 'env.json' +if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' +} + +if (Test-Path -Path (Join-Path $PSScriptRoot $envFile)) { + $envFilePath = Join-Path $PSScriptRoot $envFile +} else { + $envFilePath = Join-Path $PSScriptRoot '..\$envFile' +} +$env = @{} +if (Test-Path -Path $envFilePath) { + $env = Get-Content (Join-Path $PSScriptRoot $envFile) | ConvertFrom-Json + $PSDefaultParameterValues=@{"*:SubscriptionId"=$env.SubscriptionId; "*:Tenant"=$env.Tenant} +} \ No newline at end of file diff --git a/src/Blockchain/test/readme.md b/src/Blockchain/test/readme.md new file mode 100644 index 000000000000..7c752b4c8c43 --- /dev/null +++ b/src/Blockchain/test/readme.md @@ -0,0 +1,17 @@ +# Test +This directory contains the [Pester](https://www.powershellgallery.com/packages/Pester) tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in `..\custom`) will be generated into this folder when `build-module.ps1` is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets. + +## Info +- Modifiable: yes +- Generated: partial +- Committed: yes +- Packaged: no + +## Details +We allow three testing modes: *live*, *record*, and *playback*. These can be selected using the `-Live`, `-Record`, and `-Playback` switches respectively on the `test-module.ps1` script. This script will run through any `.Tests.ps1` scripts in the `test` folder. If you choose the *record* mode, it will create a `.Recording.json` file of the REST calls between the client and server. Then, when you choose *playback* mode, it will use the `.Recording.json` file to mock the communication between server and client. The *live* mode runs the same as the *record* mode; however, it doesn't create the `.Recording.json` file. + +## Purpose +Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework. + +## Usage +To execute tests, run the `test-module.ps1`. To write tests, [this example](https://github.com/pester/Pester/blob/8b9cf4248315e44f1ac6673be149f7e0d7f10466/Examples/Planets/Get-Planet.Tests.ps1#L1) from the Pester repository is very useful for getting started. \ No newline at end of file diff --git a/src/Blockchain/test/utils.ps1 b/src/Blockchain/test/utils.ps1 new file mode 100644 index 000000000000..b4e171809fec --- /dev/null +++ b/src/Blockchain/test/utils.ps1 @@ -0,0 +1,57 @@ +function RandomString([bool]$allChars, [int32]$len) { + if ($allChars) { + return -join ((33..126) | Get-Random -Count $len | % {[char]$_}) + } else { + return -join ((48..57) + (97..122) | Get-Random -Count $len | % {[char]$_}) + } +} + +$env = @{} +function setupEnv() { + # Preload subscriptionId and tenant from context, which will be used in test + # as default. You could change them if needed. + $env.SubscriptionId = (Get-AzContext).Subscription.Id + $env.Tenant = (Get-AzContext).Tenant.Id + # For any resources you created for test, you should add it to $env here. + # Generate some random strings for use in the test. + $rstr1 = RandomString -allChars $false -len 6 + $rstr2 = RandomString -allChars $false -len 6 + $rstr3 = RandomString -allChars $false -len 6 + $rstr4 = RandomString -allChars $false -len 6 + $env.Add("rstr1", $rstr1) + $env.Add("rstr2", $rstr2) + $env.Add("rstr3", $rstr3) + $env.Add("rstr4", $rstr4) + + # Create the test group + write-host "start to create test group" + $resourceGroup = "testgroup" + $env.rstr1 + $env.Add("resourceGroup", $resourceGroup) + New-AzResourceGroup -Name $resourceGroup -Location eastus + + # Create the test blockchain member + $passwd = 'strongMemberAccountPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $csPasswd = 'strongConsortiumManagementPassword@1' | ConvertTo-SecureString -AsPlainText -Force + $env.Add("passwd", $passwd) + $env.Add("csPasswd", $csPasswd) + $env.Add("blockchainMember", "myblockchain" + $rstr1) + New-AzBlockchainMember -Name $env.blockchainMember -ResourceGroupName $env.resourceGroup -Consortium ('consortium' + $env.rstr1) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + New-AzBlockchainMember -Name ("myblockchain" + $rstr4) -ResourceGroupName $env.resourceGroup -Consortium ('consortium' + $env.rstr4) -ConsortiumManagementAccountPassword $csPasswd -Location eastus -Password $passwd -Protocol Quorum -Sku S0 + + # Create the test blockchain transaction node + $env.Add("blockchainTransactionNode", "tranctionnode" + $rstr1) + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name $env.blockchainTransactionNode -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd -confirm:$false + New-AzBlockchainTransactionNode -BlockchainMemberName $env.blockchainMember -Name ("tranctionnode" + $rstr4) -ResourceGroupName $env.resourceGroup -Location eastus -Password $passwd -confirm:$false + + $envFile = 'env.json' + if ($TestMode -eq 'live') { + $envFile = 'localEnv.json' + } + set-content -Path (Join-Path $PSScriptRoot $envFile) -Value (ConvertTo-Json $env) +} +function cleanupEnv() { + # Clean resources you create for testing + # Removing resourcegroup will clean all the resources created for testing. + Remove-AzResourceGroup -Name $env.resourceGroup +} + From 8443efd62308081d2bf63db3c29b2a0e2ff7eac9 Mon Sep 17 00:00:00 2001 From: msJinLei Date: Mon, 25 May 2020 16:11:14 +0800 Subject: [PATCH 5/5] Fix Blockchain file names --- .../{Az.BlockChain.format.ps1xml => Az.Blockchain.format.ps1xml} | 0 src/Blockchain/{Az.BlockChain.psd1 => Az.Blockchain.psd1} | 0 src/Blockchain/{Az.BlockChain.psm1 => Az.Blockchain.psm1} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/Blockchain/{Az.BlockChain.format.ps1xml => Az.Blockchain.format.ps1xml} (100%) rename src/Blockchain/{Az.BlockChain.psd1 => Az.Blockchain.psd1} (100%) rename src/Blockchain/{Az.BlockChain.psm1 => Az.Blockchain.psm1} (100%) diff --git a/src/Blockchain/Az.BlockChain.format.ps1xml b/src/Blockchain/Az.Blockchain.format.ps1xml similarity index 100% rename from src/Blockchain/Az.BlockChain.format.ps1xml rename to src/Blockchain/Az.Blockchain.format.ps1xml diff --git a/src/Blockchain/Az.BlockChain.psd1 b/src/Blockchain/Az.Blockchain.psd1 similarity index 100% rename from src/Blockchain/Az.BlockChain.psd1 rename to src/Blockchain/Az.Blockchain.psd1 diff --git a/src/Blockchain/Az.BlockChain.psm1 b/src/Blockchain/Az.Blockchain.psm1 similarity index 100% rename from src/Blockchain/Az.BlockChain.psm1 rename to src/Blockchain/Az.Blockchain.psm1